From 17ff7e25c71fa09cdcf7a304b9b639ccf01078de Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Wed, 14 Feb 2024 16:16:25 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20CreateFi?= =?UTF-8?q?lesUpdateEveryColumn()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db_crud_tables/db_crud_tables.go | 14 +++---- .../grpc_client_tables/grpc_client_tables.go | 38 ++++++++++--------- .../grpc_server_tables/grpc_server_tables.go | 25 ++++++------ 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/internal/create_files/db_crud_tables/db_crud_tables.go b/internal/create_files/db_crud_tables/db_crud_tables.go index 316ae9c..14db937 100644 --- a/internal/create_files/db_crud_tables/db_crud_tables.go +++ b/internal/create_files/db_crud_tables/db_crud_tables.go @@ -495,15 +495,15 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error { ` //заменим импорты - //if config.Settings.USE_DEFAULT_TEMPLATE == true { - DBConstantsURL := create_files.FindDBConstantsURL() - TextCrud = create_files.AddImport(TextCrud, DBConstantsURL) + if config.Settings.USE_DEFAULT_TEMPLATE == true { + DBConstantsURL := create_files.FindDBConstantsURL() + TextCrud = create_files.AddImport(TextCrud, DBConstantsURL) - ModelTableURL := create_files.FindModelTableURL(TableName) - TextCrud = create_files.AddImport(TextCrud, ModelTableURL) + ModelTableURL := create_files.FindModelTableURL(TableName) + TextCrud = create_files.AddImport(TextCrud, ModelTableURL) - //TextCrud = create_files.ConvertIdToAlias(TextCrud, Table1) - //} + //TextCrud = create_files.ConvertIdToAlias(TextCrud, Table1) + } //создание текста TextUpdateEveryColumn := FindTextUpdateEveryColumn(TextCrudUpdateFunc, Table1) diff --git a/internal/create_files/grpc_client_tables/grpc_client_tables.go b/internal/create_files/grpc_client_tables/grpc_client_tables.go index 2af14c0..cb876c3 100644 --- a/internal/create_files/grpc_client_tables/grpc_client_tables.go +++ b/internal/create_files/grpc_client_tables/grpc_client_tables.go @@ -389,27 +389,27 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error { ` //заменим импорты - //if config.Settings.USE_DEFAULT_TEMPLATE == true { - ProtoURL := create_files.FindProtoURL() - TextGRPC_Client = create_files.AddImport(TextGRPC_Client, ProtoURL) + if config.Settings.USE_DEFAULT_TEMPLATE == true { + ProtoURL := create_files.FindProtoURL() + TextGRPC_Client = create_files.AddImport(TextGRPC_Client, ProtoURL) - GRPCClientURL := create_files.FindGRPClientURL() - TextGRPC_Client = create_files.AddImport(TextGRPC_Client, GRPCClientURL) + GRPCClientURL := create_files.FindGRPClientURL() + TextGRPC_Client = create_files.AddImport(TextGRPC_Client, GRPCClientURL) - GRPCConstantsURL := create_files.FindGRPCConstantsURL() - TextGRPC_Client = create_files.AddImport(TextGRPC_Client, GRPCConstantsURL) + GRPCConstantsURL := create_files.FindGRPCConstantsURL() + TextGRPC_Client = create_files.AddImport(TextGRPC_Client, GRPCConstantsURL) - GRPC_NRPC_URL := create_files.Find_GRPC_NRPC_URL() - TextGRPC_Client = create_files.AddImport(TextGRPC_Client, GRPC_NRPC_URL) + GRPC_NRPC_URL := create_files.Find_GRPC_NRPC_URL() + TextGRPC_Client = create_files.AddImport(TextGRPC_Client, GRPC_NRPC_URL) - NRPCClientURL := create_files.FindNRPClientURL() - TextGRPC_Client = create_files.AddImport(TextGRPC_Client, NRPCClientURL) + NRPCClientURL := create_files.FindNRPClientURL() + TextGRPC_Client = create_files.AddImport(TextGRPC_Client, NRPCClientURL) - ModelTableURL := create_files.FindModelTableURL(TableName) - TextGRPC_Client = create_files.AddImport(TextGRPC_Client, ModelTableURL) + ModelTableURL := create_files.FindModelTableURL(TableName) + TextGRPC_Client = create_files.AddImport(TextGRPC_Client, ModelTableURL) - //TextGRPC_Client = create_files.ConvertIdToAlias(TextGRPC_Client, Table1) - //} + //TextGRPC_Client = create_files.ConvertIdToAlias(TextGRPC_Client, Table1) + } //создание текста TextUpdateEveryColumn := FindTextUpdateEveryColumn(TextGRPC_ClientUpdateFunc, Table1) @@ -428,9 +428,11 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error { //удаление пустого импорта TextGRPC_Client = create_files.DeleteEmptyImport(TextGRPC_Client) TextGRPC_Client = create_files.DeleteEmptyLines(TextGRPC_Client) - TextGRPC_Client = create_files.CheckAndAddImportTime_FromText(TextGRPC_Client) - TextGRPC_Client = create_files.CheckAndAddImportTimestamp_FromText(TextGRPC_Client) - TextGRPC_Client = create_files.CheckAndAddImportAlias(TextGRPC_Client) + if config.Settings.USE_DEFAULT_TEMPLATE == true { + TextGRPC_Client = create_files.CheckAndAddImportTime_FromText(TextGRPC_Client) + TextGRPC_Client = create_files.CheckAndAddImportTimestamp_FromText(TextGRPC_Client) + TextGRPC_Client = create_files.CheckAndAddImportAlias(TextGRPC_Client) + } //запись файла err = os.WriteFile(FilenameReadyGRPC_ClientUpdate, []byte(TextGRPC_Client), constants.FILE_PERMISSIONS) diff --git a/internal/create_files/grpc_server_tables/grpc_server_tables.go b/internal/create_files/grpc_server_tables/grpc_server_tables.go index 2b84e5c..535fe54 100644 --- a/internal/create_files/grpc_server_tables/grpc_server_tables.go +++ b/internal/create_files/grpc_server_tables/grpc_server_tables.go @@ -373,17 +373,17 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error { ` //заменим импорты - //if config.Settings.USE_DEFAULT_TEMPLATE == true { - ModelTableURL := create_files.FindModelTableURL(TableName) - TextGRPCServer = create_files.AddImport(TextGRPCServer, ModelTableURL) + if config.Settings.USE_DEFAULT_TEMPLATE == true { + ModelTableURL := create_files.FindModelTableURL(TableName) + TextGRPCServer = create_files.AddImport(TextGRPCServer, ModelTableURL) - ProtoURL := create_files.FindProtoURL() - TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL) + ProtoURL := create_files.FindProtoURL() + TextGRPCServer = create_files.AddImport(TextGRPCServer, ProtoURL) - //ModelURL := create_files.FindModelURL() - //TextGRPCServer = create_files.AddImport(TextGRPCServer, ModelURL) + //ModelURL := create_files.FindModelURL() + //TextGRPCServer = create_files.AddImport(TextGRPCServer, ModelURL) - //} + } //создание текста TextUpdateEveryColumn := FindTextUpdateEveryColumn(TextGRPCServerUpdateFunc, Table1) @@ -397,10 +397,11 @@ func CreateFilesUpdateEveryColumn(Table1 *types.Table) error { //TextGRPCServer = strings.ReplaceAll(TextGRPCServer, config.Settings.TEXT_TEMPLATE_TABLENAME, Table1.Name) TextGRPCServer = TextGRPCServer + TextUpdateEveryColumn - TextGRPCServer = create_files.ConvertIdToAlias(TextGRPCServer, Table1) - TextGRPCServer = create_files.CheckAndAddImportAlias(TextGRPCServer) - - TextGRPCServer = config.Settings.TEXT_MODULE_GENERATED + TextGRPCServer + if config.Settings.USE_DEFAULT_TEMPLATE == true { + TextGRPCServer = create_files.ConvertIdToAlias(TextGRPCServer, Table1) + TextGRPCServer = create_files.CheckAndAddImportAlias(TextGRPCServer) + TextGRPCServer = config.Settings.TEXT_MODULE_GENERATED + TextGRPCServer + } //удаление пустого импорта TextGRPCServer = create_files.DeleteEmptyImport(TextGRPCServer)