1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2025-05-31 23:29:36 +02:00

сделал find_by_functions.json

This commit is contained in:
Nikitin Aleksandr 2024-08-21 16:32:06 +03:00
parent 3728093fcc
commit 34b476600f
23 changed files with 85 additions and 44 deletions

View File

@ -8,12 +8,9 @@ func Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(t *testing
Request.VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion() Request.VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion()
server1 := &ServerGRPC{} server1 := &ServerGRPC{}
Otvet, err := server1.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(ctx, &Request) _, err := server1.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(ctx, &Request)
if err != nil { if err != nil {
t.Log("Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline() error: ", err) t.Log("Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline() error: ", err)
} }
if Otvet.ModelString == "" {
t.Log("Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline() error: ModelString=''")
}
} }

View File

@ -2,7 +2,6 @@ package crud_lawsuit_status_types
import ( import (
"context" "context"
"errors"
"github.com/ManyakRus/starter/postgres_gorm" "github.com/ManyakRus/starter/postgres_gorm"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"

View File

@ -2,7 +2,6 @@ package crud_lawsuit_status_types
import ( import (
"context" "context"
"errors"
"github.com/ManyakRus/starter/postgres_gorm" "github.com/ManyakRus/starter/postgres_gorm"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/db/db_constants"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"

View File

@ -1,6 +1,6 @@
// FindMassBy_FieldNamesWithUnderline - находит запись в БД по FieldNamesWithPlus // FindMassBy_FieldNamesWithUnderline - находит запись в БД по FieldNamesWithPlus
func (crud Crud_DB) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) { func (crud Crud_DB) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) {
Otvet := make([]files.File, 0) Otvet := make([]lawsuit_status_types.LawsuitStatusType, 0)
var err error var err error
ctxMain := context.Background() ctxMain := context.Background()
@ -17,7 +17,7 @@ func (crud Crud_DB) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.L
// FindMassBy_FieldNamesWithUnderline_ctx - находит запись в БД по FieldNamesWithPlus // FindMassBy_FieldNamesWithUnderline_ctx - находит запись в БД по FieldNamesWithPlus
func FindMassBy_FieldNamesWithUnderline_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) { func FindMassBy_FieldNamesWithUnderline_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) {
var err error var err error
Otvet := make([]files.File, 0) Otvet := make([]lawsuit_status_types.LawsuitStatusType, 0)
tx := db.WithContext(ctx) tx := db.WithContext(ctx)

View File

@ -7,7 +7,7 @@ func TestFindMassBy_FieldNamesWithUnderline(t *testing.T) {
crud := Crud_DB{} crud := Crud_DB{}
Otvet := lawsuit_status_types.LawsuitStatusType{} Otvet := lawsuit_status_types.LawsuitStatusType{}
Otvet.FieldName = 0 Otvet.FieldName = 0
Otvet, err := crud.FindMassBy_FieldNamesWithUnderline(&Otvet) _, err := crud.FindMassBy_FieldNamesWithUnderline(&Otvet)
if err != nil { if err != nil {
t.Log("crud_"+TableName+"_test.TestFindMassBy_FieldNamesWithUnderline() FieldNamesWithComma:", FieldNamesDefault, " error: ", err) t.Log("crud_"+TableName+"_test.TestFindMassBy_FieldNamesWithUnderline() FieldNamesWithComma:", FieldNamesDefault, " error: ", err)
} }

View File

@ -6,8 +6,6 @@ import (
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client_func" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client_func"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_constants" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_constants"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc_nrpc"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/nrpc/nrpc_client"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"log" "log"
) )

View File

@ -24,7 +24,6 @@ func (crud Crud_GRPC) FindBy_FieldNamesWithUnderline(m *lawsuit_status_types.Law
Response, err = grpc_client_func.Client.LawsuitStatusType_FindBy_FieldNamesWithUnderline(ctx, Request) Response, err = grpc_client_func.Client.LawsuitStatusType_FindBy_FieldNamesWithUnderline(ctx, Request)
} }
if err != nil { if err != nil {
sError := err.Error()
if grpc_client_func.IsErrorModelVersion(err) == true { if grpc_client_func.IsErrorModelVersion(err) == true {
log.Panic("table: ", TableName, " error: ", err) log.Panic("table: ", TableName, " error: ", err)
} }
@ -33,7 +32,7 @@ func (crud Crud_GRPC) FindBy_FieldNamesWithUnderline(m *lawsuit_status_types.Law
// ответ // ответ
sModel := Response.ModelString sModel := Response.ModelString
err = json.Unmarshal([]byte(sModel), f) err = json.Unmarshal([]byte(sModel), m)
if err != nil { if err != nil {
return err return err
} }

View File

@ -3,7 +3,7 @@ func TestFindBy_FieldNamesWithUnderline(t *testing.T) {
grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC() grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC()
defer grpc_client.CloseConnection() defer grpc_client.CloseConnection()
crud := Crud_GRPC{} crud := grpc_lawsuit_status_types.Crud_GRPC{}
Otvet := lawsuit_status_types.LawsuitStatusType{} Otvet := lawsuit_status_types.LawsuitStatusType{}
Otvet.FieldName = 0 Otvet.FieldName = 0
err := crud.FindBy_FieldNamesWithUnderline(&Otvet) err := crud.FindBy_FieldNamesWithUnderline(&Otvet)

View File

@ -3,6 +3,9 @@ package grpc_lawsuit_status_types
import ( import (
"github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/config_main"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client_func"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client/grpc_lawsuit_status_types"
"testing" "testing"
) )

View File

@ -6,8 +6,6 @@ import (
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client_func" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client_func"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_constants" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_constants"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc_nrpc"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/nrpc/nrpc_client"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"log" "log"
) )

View File

@ -1,12 +1,10 @@
// FieldNamesWithUnderline - находит массив записей в БД по FieldNamesWithPlus // FieldNamesWithUnderline - находит массив записей в БД по FieldNamesWithPlus
func (crud Crud_GRPC) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) { func (crud Crud_GRPC) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) {
Otvet := make([]files.File, 0) Otvet := make([]lawsuit_status_types.LawsuitStatusType, 0)
// var Otvet model.File var err error
// подключение // подключение
if grpc_client_func.Client == nil { grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC()
grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC()
}
// подготовка запроса // подготовка запроса
var VersionModel = crud.GetVersionModel() var VersionModel = crud.GetVersionModel()
@ -20,9 +18,13 @@ func (crud Crud_GRPC) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types
defer ctxCancelFunc() defer ctxCancelFunc()
// запрос // запрос
Response, err := grpc_client_func.Client.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(ctx, Request) var Response *grpc_proto.ResponseMass
if grpc_nrpc.NeedNRPC == true {
Response, err = nrpc_client.Client.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(Request)
} else {
Response, err = grpc_client_func.Client.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(ctx, Request)
}
if err != nil { if err != nil {
sError := err.Error()
if grpc_client_func.IsErrorModelVersion(err) == true { if grpc_client_func.IsErrorModelVersion(err) == true {
log.Panic("table: ", TableName, " error: ", err) log.Panic("table: ", TableName, " error: ", err)
} }

View File

@ -3,10 +3,10 @@ func TestCrud_GRPC_FindMassBy_FieldNamesWithUnderline(t *testing.T) {
grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC() grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC()
defer grpc_client.CloseConnection() defer grpc_client.CloseConnection()
crud := Crud_GRPC{} crud := grpc_lawsuit_status_types.Crud_GRPC{}
Model1 := lawsuit_status_types.LawsuitStatusType{} Model1 := lawsuit_status_types.LawsuitStatusType{}
Model1.FieldName = 0 Model1.FieldName = 0
Otvet, err := crud.FindMassBy_FieldNamesWithUnderline(&Model1) _, err := crud.FindMassBy_FieldNamesWithUnderline(&Model1)
if err != nil { if err != nil {
t.Log("TestCrud_GRPC_FindMassBy_FieldNamesWithUnderline() error: ", err) t.Log("TestCrud_GRPC_FindMassBy_FieldNamesWithUnderline() error: ", err)

View File

@ -3,6 +3,9 @@ package grpc_lawsuit_status_types
import ( import (
"github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/config_main"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client_func"
"gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/network/grpc/grpc_client/grpc_lawsuit_status_types"
"testing" "testing"
) )

View File

@ -774,6 +774,15 @@ func FindModelTableURL(TableName string) string {
return Otvet return Otvet
} }
// FindGRPCClientTableURL - возвращает URL репозитория grpc_client для таблицы TableName
func FindGRPCClientTableURL(TableName string) string {
Otvet := ""
Otvet = config.Settings.SERVICE_REPOSITORY_URL + "/" + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + "/" + config.Settings.PREFIX_CLIENT_GRPC + TableName
return Otvet
}
// FindCrudStarterTableURL - возвращает URL репозитория crud_starter для таблицы TableName // FindCrudStarterTableURL - возвращает URL репозитория crud_starter для таблицы TableName
func FindCrudStarterTableURL(TableName string) string { func FindCrudStarterTableURL(TableName string) string {
Otvet := "" Otvet := ""

View File

@ -165,7 +165,7 @@ func CreateFilesFindByTest(Table1 *types.Table) error {
DirTemplatesCrud := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile() DirTemplatesCrud := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile()
DirReadyCrud := DirReady + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile() DirReadyCrud := DirReady + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile()
FilenameTemplateCrud := DirTemplatesCrud + config.Settings.TEMPLATES_CRUD_TABLE_FINDBY_FILENAME FilenameTemplateCrud := DirTemplatesCrud + config.Settings.TEMPLATES_CRUD_TABLE_FINDBY_TEST_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyCrud + config.Settings.PREFIX_CRUD + TableName DirReadyTable := DirReadyCrud + config.Settings.PREFIX_CRUD + TableName
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CRUD + TableName + "_findby_test.go" FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CRUD + TableName + "_findby_test.go"

View File

@ -171,7 +171,7 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error {
DirTemplatesCrud := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile() DirTemplatesCrud := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile()
DirReadyCrud := DirReady + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile() DirReadyCrud := DirReady + config.Settings.TEMPLATE_FOLDERNAME_CRUD + micro.SeparatorFile()
FilenameTemplateCrud := DirTemplatesCrud + config.Settings.TEMPLATES_CRUD_TABLE_FINDMASSBY_FILENAME FilenameTemplateCrud := DirTemplatesCrud + config.Settings.TEMPLATES_CRUD_TABLE_FINDMASSBY_TEST_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyCrud + config.Settings.PREFIX_CRUD + TableName DirReadyTable := DirReadyCrud + config.Settings.PREFIX_CRUD + TableName
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CRUD + TableName + "_findmassby_test.go" FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CRUD + TableName + "_findmassby_test.go"

View File

@ -63,8 +63,8 @@ func CreateFilesFindBy(Table1 *types.Table) error {
if config.Settings.USE_DEFAULT_TEMPLATE == true { if config.Settings.USE_DEFAULT_TEMPLATE == true {
TextModel = create_files.DeleteTemplateRepositoryImports(TextModel) TextModel = create_files.DeleteTemplateRepositoryImports(TextModel)
ModelTableURL := create_files.FindModelTableURL(TableName) //ModelTableURL := create_files.FindModelTableURL(TableName)
TextModel = create_files.AddImport(TextModel, ModelTableURL) //TextModel = create_files.AddImport(TextModel, ModelTableURL)
ConstantsURL := create_files.FindDBConstantsURL() ConstantsURL := create_files.FindDBConstantsURL()
TextModel = create_files.AddImport(TextModel, ConstantsURL) TextModel = create_files.AddImport(TextModel, ConstantsURL)

View File

@ -63,8 +63,8 @@ func CreateFilesFindMassBy(Table1 *types.Table) error {
if config.Settings.USE_DEFAULT_TEMPLATE == true { if config.Settings.USE_DEFAULT_TEMPLATE == true {
TextModel = create_files.DeleteTemplateRepositoryImports(TextModel) TextModel = create_files.DeleteTemplateRepositoryImports(TextModel)
ModelTableURL := create_files.FindModelTableURL(TableName) //ModelTableURL := create_files.FindModelTableURL(TableName)
TextModel = create_files.AddImport(TextModel, ModelTableURL) //TextModel = create_files.AddImport(TextModel, ModelTableURL)
ConstantsURL := create_files.FindDBConstantsURL() ConstantsURL := create_files.FindDBConstantsURL()
TextModel = create_files.AddImport(TextModel, ConstantsURL) TextModel = create_files.AddImport(TextModel, ConstantsURL)

View File

@ -28,8 +28,8 @@ func CreateFilesFindBy(Table1 *types.Table) error {
FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCClient DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile()
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby.go" FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby.go"
//создадим каталог //создадим каталог
ok, err := micro.FileExists(DirReadyTable) ok, err := micro.FileExists(DirReadyTable)
@ -104,6 +104,9 @@ func CreateFilesFindBy(Table1 *types.Table) error {
//alias //alias
TextGRPCClient = create_files.CheckAndAddImportAlias(TextGRPCClient) TextGRPCClient = create_files.CheckAndAddImportAlias(TextGRPCClient)
//time
TextGRPCClient = create_files.CheckAndAddImportTime_FromText(TextGRPCClient)
//удаление пустого импорта //удаление пустого импорта
TextGRPCClient = create_files.DeleteEmptyImport(TextGRPCClient) TextGRPCClient = create_files.DeleteEmptyImport(TextGRPCClient)
@ -188,10 +191,10 @@ func CreateFilesFindByTest(Table1 *types.Table) error {
DirTemplatesGRPCClient := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile() DirTemplatesGRPCClient := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile()
DirReadyGRPCClient := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile() DirReadyGRPCClient := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile()
FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_TEST_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCClient DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile()
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby_test.go" FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby_test.go"
//создадим каталог //создадим каталог
ok, err := micro.FileExists(DirReadyTable) ok, err := micro.FileExists(DirReadyTable)
@ -227,6 +230,15 @@ func CreateFilesFindByTest(Table1 *types.Table) error {
ModelTableURL := create_files.FindModelTableURL(TableName) ModelTableURL := create_files.FindModelTableURL(TableName)
TextGRPCClient = create_files.AddImport(TextGRPCClient, ModelTableURL) TextGRPCClient = create_files.AddImport(TextGRPCClient, ModelTableURL)
GRPCClient_func_URL := create_files.Find_GRPCClient_func_URL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPCClient_func_URL)
GRPClientURL := create_files.FindGRPClientURL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientURL)
GRPClientTableURL := create_files.FindGRPCClientTableURL(Table1.Name)
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientTableURL)
} }
//создание функций //создание функций

View File

@ -28,8 +28,8 @@ func CreateFilesFindMassBy(Table1 *types.Table) error {
FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCClient DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile()
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby.go" FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby.go"
//создадим каталог //создадим каталог
ok, err := micro.FileExists(DirReadyTable) ok, err := micro.FileExists(DirReadyTable)
@ -104,6 +104,9 @@ func CreateFilesFindMassBy(Table1 *types.Table) error {
//alias //alias
TextGRPCClient = create_files.CheckAndAddImportAlias(TextGRPCClient) TextGRPCClient = create_files.CheckAndAddImportAlias(TextGRPCClient)
//time
TextGRPCClient = create_files.CheckAndAddImportTime_FromText(TextGRPCClient)
//удаление пустого импорта //удаление пустого импорта
TextGRPCClient = create_files.DeleteEmptyImport(TextGRPCClient) TextGRPCClient = create_files.DeleteEmptyImport(TextGRPCClient)
@ -187,10 +190,10 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error {
DirTemplatesGRPCClient := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile() DirTemplatesGRPCClient := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile()
DirReadyGRPCClient := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile() DirReadyGRPCClient := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_CLIENT + micro.SeparatorFile()
FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_TEST_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCClient DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile()
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby_test.go" FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby_test.go"
//создадим каталог //создадим каталог
ok, err := micro.FileExists(DirReadyTable) ok, err := micro.FileExists(DirReadyTable)
@ -226,6 +229,15 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error {
ModelTableURL := create_files.FindModelTableURL(TableName) ModelTableURL := create_files.FindModelTableURL(TableName)
TextGRPCClient = create_files.AddImport(TextGRPCClient, ModelTableURL) TextGRPCClient = create_files.AddImport(TextGRPCClient, ModelTableURL)
GRPCClient_func_URL := create_files.Find_GRPCClient_func_URL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPCClient_func_URL)
GRPClientURL := create_files.FindGRPClientURL()
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientURL)
GRPClientTableURL := create_files.FindGRPCClientTableURL(Table1.Name)
TextGRPCClient = create_files.AddImport(TextGRPCClient, GRPClientTableURL)
} }
//создание функций //создание функций

View File

@ -816,7 +816,7 @@ func FindText_FindMassBy(TextProto string, Table1 *types.Table) (string, string)
Otvet := TextProto Otvet := TextProto
Otvet2 := "" Otvet2 := ""
for _, TableColumns1 := range types.MassFindBy { for _, TableColumns1 := range types.MassFindMassBy {
if TableColumns1.Table.Name != Table1.Name { if TableColumns1.Table.Name != Table1.Name {
continue continue
} }

View File

@ -183,7 +183,7 @@ func CreateFilesFindByTest(Table1 *types.Table) error {
DirTemplatesGRPCServer := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile() DirTemplatesGRPCServer := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile()
DirReadyGRPCServer := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile() DirReadyGRPCServer := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile()
FilenameTemplateGRPCServer := DirTemplatesGRPCServer + config.Settings.TEMPLATES_GRPC_SERVER_FINDBY_FILENAME FilenameTemplateGRPCServer := DirTemplatesGRPCServer + config.Settings.TEMPLATES_GRPC_SERVER_FINDBY_TEST_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCServer DirReadyTable := DirReadyGRPCServer
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_SERVER_GRPC + TableName + "_findby_test.go" FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_SERVER_GRPC + TableName + "_findby_test.go"
@ -296,6 +296,7 @@ func CreateFilesFindByTestTable1(Table1 *types.Table, TextTemplateFunction strin
Underline := "" Underline := ""
Comma := "" Comma := ""
RequestName := "Request_"
for _, ColumnName1 := range MassColumnsString { for _, ColumnName1 := range MassColumnsString {
Column1, ok := Table1.MapColumns[ColumnName1] Column1, ok := Table1.MapColumns[ColumnName1]
if ok == false { if ok == false {
@ -308,9 +309,13 @@ func CreateFilesFindByTestTable1(Table1 *types.Table, TextTemplateFunction strin
FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo
TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue
ProtoTypeName := create_files.ConvertGolangTypeNameToProtobufFieldName(Column1.TypeGo)
RequestName = RequestName + Underline + ProtoTypeName
Underline = "_" Underline = "_"
Comma = ", " Comma = ", "
} }
Otvet = strings.ReplaceAll(Otvet, "RequestName", RequestName)
Otvet = strings.ReplaceAll(Otvet, TextAssignFind, TextAssign) Otvet = strings.ReplaceAll(Otvet, TextAssignFind, TextAssign)
Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithUnderline", FieldNamesWithUnderline) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithUnderline", FieldNamesWithUnderline)
Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithComma", FieldNamesWithComma) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithComma", FieldNamesWithComma)

View File

@ -183,7 +183,7 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error {
DirTemplatesGRPCServer := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile() DirTemplatesGRPCServer := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile()
DirReadyGRPCServer := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile() DirReadyGRPCServer := DirReady + config.Settings.TEMPLATE_FOLDERNAME_GRPC_SERVER + micro.SeparatorFile()
FilenameTemplateGRPCServer := DirTemplatesGRPCServer + config.Settings.TEMPLATES_GRPC_SERVER_FINDMASSBY_FILENAME FilenameTemplateGRPCServer := DirTemplatesGRPCServer + config.Settings.TEMPLATES_GRPC_SERVER_FINDMASSBY_TEST_FILENAME
TableName := strings.ToLower(Table1.Name) TableName := strings.ToLower(Table1.Name)
DirReadyTable := DirReadyGRPCServer DirReadyTable := DirReadyGRPCServer
FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_SERVER_GRPC + TableName + "_findmassby_test.go" FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_SERVER_GRPC + TableName + "_findmassby_test.go"
@ -294,6 +294,7 @@ func CreateFilesFindMassByTestTable1(Table1 *types.Table, TextTemplateFunction s
MassColumns := create_files.FindMassColumns_from_MassColumnsString(Table1, MassColumnsString) MassColumns := create_files.FindMassColumns_from_MassColumnsString(Table1, MassColumnsString)
RequestName := "Request_"
Underline := "" Underline := ""
Comma := "" Comma := ""
for _, ColumnName1 := range MassColumnsString { for _, ColumnName1 := range MassColumnsString {
@ -308,10 +309,14 @@ func CreateFilesFindMassByTestTable1(Table1 *types.Table, TextTemplateFunction s
FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo
TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue
ProtoTypeName := create_files.ConvertGolangTypeNameToProtobufFieldName(Column1.TypeGo)
RequestName = RequestName + Underline + ProtoTypeName
Underline = "_" Underline = "_"
Comma = ", " Comma = ", "
} }
Otvet = strings.ReplaceAll(Otvet, TextAssignFind, TextAssign) Otvet = strings.ReplaceAll(Otvet, TextAssignFind, TextAssign)
Otvet = strings.ReplaceAll(Otvet, "RequestName", RequestName)
Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithUnderline", FieldNamesWithUnderline) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithUnderline", FieldNamesWithUnderline)
Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithComma", FieldNamesWithComma) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithComma", FieldNamesWithComma)
Otvet = strings.ReplaceAll(Otvet, "FieldNamesDefault", TextFieldName_TEST) Otvet = strings.ReplaceAll(Otvet, "FieldNamesDefault", TextFieldName_TEST)