diff --git a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_findmassby_function_test.go_ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_findmassby_function_test.go_ index 44d3bbb..34d3bf1 100644 --- a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_findmassby_function_test.go_ +++ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_findmassby_function_test.go_ @@ -8,12 +8,9 @@ func Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(t *testing Request.VersionModel = lawsuit_status_types.LawsuitStatusType{}.GetStructVersion() server1 := &ServerGRPC{} - Otvet, err := server1.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(ctx, &Request) + _, err := server1.LawsuitStatusType_FindMassBy_FieldNamesWithUnderline(ctx, &Request) if err != nil { t.Log("Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline() error: ", err) } - if Otvet.ModelString == "" { - t.Log("Test_server_LawsuitStatusType_FindMassBy_FieldNamesWithUnderline() error: ModelString=''") - } } diff --git a/bin/templates/pkg/db/crud/crud_tables_findby.go_ b/bin/templates/pkg/db/crud/crud_tables_findby.go_ index fa9143c..7da8668 100644 --- a/bin/templates/pkg/db/crud/crud_tables_findby.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_findby.go_ @@ -2,7 +2,6 @@ package crud_lawsuit_status_types import ( "context" - "errors" "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/object_model/entities/lawsuit_status_types" diff --git a/bin/templates/pkg/db/crud/crud_tables_findmassby.go_ b/bin/templates/pkg/db/crud/crud_tables_findmassby.go_ index fa9143c..7da8668 100644 --- a/bin/templates/pkg/db/crud/crud_tables_findmassby.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_findmassby.go_ @@ -2,7 +2,6 @@ package crud_lawsuit_status_types import ( "context" - "errors" "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/object_model/entities/lawsuit_status_types" diff --git a/bin/templates/pkg/db/crud/crud_tables_findmassby_function.go_ b/bin/templates/pkg/db/crud/crud_tables_findmassby_function.go_ index de0d009..eaa70bc 100644 --- a/bin/templates/pkg/db/crud/crud_tables_findmassby_function.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_findmassby_function.go_ @@ -1,6 +1,6 @@ // FindMassBy_FieldNamesWithUnderline - находит запись в БД по FieldNamesWithPlus 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 ctxMain := context.Background() @@ -17,7 +17,7 @@ func (crud Crud_DB) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.L // FindMassBy_FieldNamesWithUnderline_ctx - находит запись в БД по FieldNamesWithPlus func FindMassBy_FieldNamesWithUnderline_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) { var err error - Otvet := make([]files.File, 0) + Otvet := make([]lawsuit_status_types.LawsuitStatusType, 0) tx := db.WithContext(ctx) diff --git a/bin/templates/pkg/db/crud/crud_tables_findmassby_function_test.go_ b/bin/templates/pkg/db/crud/crud_tables_findmassby_function_test.go_ index d875c4e..f3fa362 100644 --- a/bin/templates/pkg/db/crud/crud_tables_findmassby_function_test.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_findmassby_function_test.go_ @@ -7,7 +7,7 @@ func TestFindMassBy_FieldNamesWithUnderline(t *testing.T) { crud := Crud_DB{} Otvet := lawsuit_status_types.LawsuitStatusType{} Otvet.FieldName = 0 - Otvet, err := crud.FindMassBy_FieldNamesWithUnderline(&Otvet) + _, err := crud.FindMassBy_FieldNamesWithUnderline(&Otvet) if err != nil { t.Log("crud_"+TableName+"_test.TestFindMassBy_FieldNamesWithUnderline() FieldNamesWithComma:", FieldNamesDefault, " error: ", err) } diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby.go_ index 86e142a..2b96c28 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby.go_ @@ -6,8 +6,6 @@ import ( "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_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" "log" ) diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function.go_ index 87837be..18adb17 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function.go_ @@ -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) } if err != nil { - sError := err.Error() if grpc_client_func.IsErrorModelVersion(err) == true { log.Panic("table: ", TableName, " error: ", err) } @@ -33,7 +32,7 @@ func (crud Crud_GRPC) FindBy_FieldNamesWithUnderline(m *lawsuit_status_types.Law // ответ sModel := Response.ModelString - err = json.Unmarshal([]byte(sModel), f) + err = json.Unmarshal([]byte(sModel), m) if err != nil { return err } diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function_test.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function_test.go_ index 6375b40..eb913f1 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function_test.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_function_test.go_ @@ -3,7 +3,7 @@ func TestFindBy_FieldNamesWithUnderline(t *testing.T) { grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC() defer grpc_client.CloseConnection() - crud := Crud_GRPC{} + crud := grpc_lawsuit_status_types.Crud_GRPC{} Otvet := lawsuit_status_types.LawsuitStatusType{} Otvet.FieldName = 0 err := crud.FindBy_FieldNamesWithUnderline(&Otvet) diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_test.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_test.go_ index 0e0279c..1de1d74 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_test.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findby_test.go_ @@ -3,6 +3,9 @@ package grpc_lawsuit_status_types import ( "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/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" ) diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby.go_ index 86e142a..2b96c28 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby.go_ @@ -6,8 +6,6 @@ import ( "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_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" "log" ) diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function.go_ index 43493a1..b776571 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function.go_ @@ -1,12 +1,10 @@ // FieldNamesWithUnderline - находит массив записей в БД по FieldNamesWithPlus func (crud Crud_GRPC) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types.LawsuitStatusType) ([]lawsuit_status_types.LawsuitStatusType, error) { - Otvet := make([]files.File, 0) - // var Otvet model.File + Otvet := make([]lawsuit_status_types.LawsuitStatusType, 0) + 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() @@ -20,9 +18,13 @@ func (crud Crud_GRPC) FindMassBy_FieldNamesWithUnderline(m *lawsuit_status_types 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 { - sError := err.Error() if grpc_client_func.IsErrorModelVersion(err) == true { log.Panic("table: ", TableName, " error: ", err) } diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function_test.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function_test.go_ index ceb9308..bf89b9d 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function_test.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_function_test.go_ @@ -3,10 +3,10 @@ func TestCrud_GRPC_FindMassBy_FieldNamesWithUnderline(t *testing.T) { grpc_client_func.Func_Connect_GRPC_NRPC.Connect_GRPC_NRPC() defer grpc_client.CloseConnection() - crud := Crud_GRPC{} + crud := grpc_lawsuit_status_types.Crud_GRPC{} Model1 := lawsuit_status_types.LawsuitStatusType{} Model1.FieldName = 0 - Otvet, err := crud.FindMassBy_FieldNamesWithUnderline(&Model1) + _, err := crud.FindMassBy_FieldNamesWithUnderline(&Model1) if err != nil { t.Log("TestCrud_GRPC_FindMassBy_FieldNamesWithUnderline() error: ", err) diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_test.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_test.go_ index 0e0279c..1de1d74 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_test.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_findmassby_test.go_ @@ -3,6 +3,9 @@ package grpc_lawsuit_status_types import ( "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/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" ) diff --git a/internal/create_files/create_files.go b/internal/create_files/create_files.go index 1bec47d..720a99e 100644 --- a/internal/create_files/create_files.go +++ b/internal/create_files/create_files.go @@ -774,6 +774,15 @@ func FindModelTableURL(TableName string) string { 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 func FindCrudStarterTableURL(TableName string) string { Otvet := "" diff --git a/internal/create_files/crud_tables/crud_tables_findby.go b/internal/create_files/crud_tables/crud_tables_findby.go index 4d41a4f..704a44a 100644 --- a/internal/create_files/crud_tables/crud_tables_findby.go +++ b/internal/create_files/crud_tables/crud_tables_findby.go @@ -165,7 +165,7 @@ func CreateFilesFindByTest(Table1 *types.Table) error { DirTemplatesCrud := DirTemplates + 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) DirReadyTable := DirReadyCrud + config.Settings.PREFIX_CRUD + TableName FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CRUD + TableName + "_findby_test.go" diff --git a/internal/create_files/crud_tables/crud_tables_findmassby.go b/internal/create_files/crud_tables/crud_tables_findmassby.go index 1c722ec..e12910f 100644 --- a/internal/create_files/crud_tables/crud_tables_findmassby.go +++ b/internal/create_files/crud_tables/crud_tables_findmassby.go @@ -171,7 +171,7 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error { DirTemplatesCrud := DirTemplates + 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) DirReadyTable := DirReadyCrud + config.Settings.PREFIX_CRUD + TableName FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CRUD + TableName + "_findmassby_test.go" diff --git a/internal/create_files/entities_tables/entities_tables_findby.go b/internal/create_files/entities_tables/entities_tables_findby.go index 07ba251..8982ca8 100644 --- a/internal/create_files/entities_tables/entities_tables_findby.go +++ b/internal/create_files/entities_tables/entities_tables_findby.go @@ -63,8 +63,8 @@ func CreateFilesFindBy(Table1 *types.Table) error { if config.Settings.USE_DEFAULT_TEMPLATE == true { TextModel = create_files.DeleteTemplateRepositoryImports(TextModel) - ModelTableURL := create_files.FindModelTableURL(TableName) - TextModel = create_files.AddImport(TextModel, ModelTableURL) + //ModelTableURL := create_files.FindModelTableURL(TableName) + //TextModel = create_files.AddImport(TextModel, ModelTableURL) ConstantsURL := create_files.FindDBConstantsURL() TextModel = create_files.AddImport(TextModel, ConstantsURL) diff --git a/internal/create_files/entities_tables/entities_tables_findmassby.go b/internal/create_files/entities_tables/entities_tables_findmassby.go index 871fd5c..e07a499 100644 --- a/internal/create_files/entities_tables/entities_tables_findmassby.go +++ b/internal/create_files/entities_tables/entities_tables_findmassby.go @@ -63,8 +63,8 @@ func CreateFilesFindMassBy(Table1 *types.Table) error { if config.Settings.USE_DEFAULT_TEMPLATE == true { TextModel = create_files.DeleteTemplateRepositoryImports(TextModel) - ModelTableURL := create_files.FindModelTableURL(TableName) - TextModel = create_files.AddImport(TextModel, ModelTableURL) + //ModelTableURL := create_files.FindModelTableURL(TableName) + //TextModel = create_files.AddImport(TextModel, ModelTableURL) ConstantsURL := create_files.FindDBConstantsURL() TextModel = create_files.AddImport(TextModel, ConstantsURL) diff --git a/internal/create_files/grpc_client_tables/grpc_client_tables_findby.go b/internal/create_files/grpc_client_tables/grpc_client_tables_findby.go index 596d73c..52b41d4 100644 --- a/internal/create_files/grpc_client_tables/grpc_client_tables_findby.go +++ b/internal/create_files/grpc_client_tables/grpc_client_tables_findby.go @@ -28,8 +28,8 @@ func CreateFilesFindBy(Table1 *types.Table) error { FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDBY_FILENAME TableName := strings.ToLower(Table1.Name) - DirReadyTable := DirReadyGRPCClient - FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby.go" + DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby.go" //создадим каталог ok, err := micro.FileExists(DirReadyTable) @@ -104,6 +104,9 @@ func CreateFilesFindBy(Table1 *types.Table) error { //alias TextGRPCClient = create_files.CheckAndAddImportAlias(TextGRPCClient) + //time + TextGRPCClient = create_files.CheckAndAddImportTime_FromText(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() 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) - DirReadyTable := DirReadyGRPCClient - FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby_test.go" + DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findby_test.go" //создадим каталог ok, err := micro.FileExists(DirReadyTable) @@ -227,6 +230,15 @@ func CreateFilesFindByTest(Table1 *types.Table) error { ModelTableURL := create_files.FindModelTableURL(TableName) 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) } //создание функций diff --git a/internal/create_files/grpc_client_tables/grpc_client_tables_findmassby.go b/internal/create_files/grpc_client_tables/grpc_client_tables_findmassby.go index 41c9148..f7cb785 100644 --- a/internal/create_files/grpc_client_tables/grpc_client_tables_findmassby.go +++ b/internal/create_files/grpc_client_tables/grpc_client_tables_findmassby.go @@ -28,8 +28,8 @@ func CreateFilesFindMassBy(Table1 *types.Table) error { FilenameTemplateGRPCClient := DirTemplatesGRPCClient + config.Settings.TEMPLATES_GRPC_CLIENT_TABLES_FINDMASSBY_FILENAME TableName := strings.ToLower(Table1.Name) - DirReadyTable := DirReadyGRPCClient - FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby.go" + DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby.go" //создадим каталог ok, err := micro.FileExists(DirReadyTable) @@ -104,6 +104,9 @@ func CreateFilesFindMassBy(Table1 *types.Table) error { //alias TextGRPCClient = create_files.CheckAndAddImportAlias(TextGRPCClient) + //time + TextGRPCClient = create_files.CheckAndAddImportTime_FromText(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() 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) - DirReadyTable := DirReadyGRPCClient - FilenameReady := DirReadyTable + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby_test.go" + DirReadyTable := DirReadyGRPCClient + micro.SeparatorFile() + config.Settings.PREFIX_CLIENT_GRPC + TableName + micro.SeparatorFile() + "tests" + micro.SeparatorFile() + FilenameReady := DirReadyTable + config.Settings.PREFIX_CLIENT_GRPC + TableName + "_findmassby_test.go" //создадим каталог ok, err := micro.FileExists(DirReadyTable) @@ -226,6 +229,15 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error { ModelTableURL := create_files.FindModelTableURL(TableName) 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) } //создание функций diff --git a/internal/create_files/protobuf/protobuf.go b/internal/create_files/protobuf/protobuf.go index 4d53e82..db0f59a 100644 --- a/internal/create_files/protobuf/protobuf.go +++ b/internal/create_files/protobuf/protobuf.go @@ -816,7 +816,7 @@ func FindText_FindMassBy(TextProto string, Table1 *types.Table) (string, string) Otvet := TextProto Otvet2 := "" - for _, TableColumns1 := range types.MassFindBy { + for _, TableColumns1 := range types.MassFindMassBy { if TableColumns1.Table.Name != Table1.Name { continue } diff --git a/internal/create_files/server_grpc_tables/server_grpc_tables_findby.go b/internal/create_files/server_grpc_tables/server_grpc_tables_findby.go index dc2329e..c0d4a6a 100644 --- a/internal/create_files/server_grpc_tables/server_grpc_tables_findby.go +++ b/internal/create_files/server_grpc_tables/server_grpc_tables_findby.go @@ -183,7 +183,7 @@ func CreateFilesFindByTest(Table1 *types.Table) error { DirTemplatesGRPCServer := DirTemplates + 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) DirReadyTable := DirReadyGRPCServer 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 := "" Comma := "" + RequestName := "Request_" for _, ColumnName1 := range MassColumnsString { Column1, ok := Table1.MapColumns[ColumnName1] if ok == false { @@ -308,9 +309,13 @@ func CreateFilesFindByTestTable1(Table1 *types.Table, TextTemplateFunction strin FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue + ProtoTypeName := create_files.ConvertGolangTypeNameToProtobufFieldName(Column1.TypeGo) + RequestName = RequestName + Underline + ProtoTypeName + Underline = "_" Comma = ", " } + Otvet = strings.ReplaceAll(Otvet, "RequestName", RequestName) Otvet = strings.ReplaceAll(Otvet, TextAssignFind, TextAssign) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithUnderline", FieldNamesWithUnderline) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithComma", FieldNamesWithComma) diff --git a/internal/create_files/server_grpc_tables/server_grpc_tables_findmassby.go b/internal/create_files/server_grpc_tables/server_grpc_tables_findmassby.go index 226bdd7..ebe7038 100644 --- a/internal/create_files/server_grpc_tables/server_grpc_tables_findmassby.go +++ b/internal/create_files/server_grpc_tables/server_grpc_tables_findmassby.go @@ -183,7 +183,7 @@ func CreateFilesFindMassByTest(Table1 *types.Table) error { DirTemplatesGRPCServer := DirTemplates + 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) DirReadyTable := DirReadyGRPCServer 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) + RequestName := "Request_" Underline := "" Comma := "" for _, ColumnName1 := range MassColumnsString { @@ -308,10 +309,14 @@ func CreateFilesFindMassByTestTable1(Table1 *types.Table, TextTemplateFunction s FieldNamesWithComma = FieldNamesWithComma + Comma + Column1.NameGo TextFieldName_TEST = TextFieldName_TEST + Comma + DefaultValue + ProtoTypeName := create_files.ConvertGolangTypeNameToProtobufFieldName(Column1.TypeGo) + RequestName = RequestName + Underline + ProtoTypeName + Underline = "_" Comma = ", " } Otvet = strings.ReplaceAll(Otvet, TextAssignFind, TextAssign) + Otvet = strings.ReplaceAll(Otvet, "RequestName", RequestName) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithUnderline", FieldNamesWithUnderline) Otvet = strings.ReplaceAll(Otvet, "FieldNamesWithComma", FieldNamesWithComma) Otvet = strings.ReplaceAll(Otvet, "FieldNamesDefault", TextFieldName_TEST)