diff --git a/bin/templates/configs_/settings.txt b/bin/templates/configs_/settings.txt index 8b29e89..b6692bf 100644 --- a/bin/templates/configs_/settings.txt +++ b/bin/templates/configs_/settings.txt @@ -243,3 +243,9 @@ TEMPLATES_README_MD_FILENAME="README.md_" #TEMPLATES_README_RUS_FILENAME - short filename of "readme.rus_" file TEMPLATES_README_RUS_FILENAME="readme.rus_" + +#TEMPLATE_FOLDERNAME_CONSTANTS - folder name for service constants +TEMPLATE_FOLDERNAME_CONSTANTS="pkg/constants" + +#TEMPLATES_CONSTANTS_FILENAME - short filename of "constants.go_" file +TEMPLATES_CONSTANTS_FILENAME="constants.go_" \ No newline at end of file diff --git a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_cache_test.go_ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_cache_test.go_ index 3af8e7a..f99aaf5 100644 --- a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_cache_test.go_ +++ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_cache_test.go_ @@ -6,12 +6,16 @@ import ( "gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/crud_starter" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" + "github.com/ManyakRus/starter/postgres_gorm" "testing" ) func Test_server_LawsuitStatusType_ReadFromCache(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() ctx := context.Background() Request := grpc_proto.RequestId{} diff --git a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_func_test.go_ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_func_test.go_ index 0f833f7..e521e43 100644 --- a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_func_test.go_ +++ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_func_test.go_ @@ -1,6 +1,8 @@ func Test_server_LawsuitStatusType_Update(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() server1 := &ServerGRPC{} ctx := context.Background() diff --git a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_test.go_ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_test.go_ index a6b639a..4f4720b 100644 --- a/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_test.go_ +++ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_table_update_test.go_ @@ -6,12 +6,17 @@ import ( "gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/crud_starter" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" + "github.com/ManyakRus/starter/postgres_gorm" "testing" ) func TestServerGRPC_LawsuitStatusType_UpdateManyFields(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() + var err error //прочитаем из БД diff --git a/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ index 53cecd2..ea92e70 100644 --- a/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ +++ b/bin/templates/internal/app/grpc/server_grpc/server_grpc_test.go_ @@ -6,6 +6,8 @@ import ( "gitlab.aescorp.ru/dsp_dev/claim/sync_service/api/grpc_proto" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/crud_starter" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" + "github.com/ManyakRus/starter/postgres_gorm" "testing" ) @@ -15,6 +17,8 @@ const LawsuitStatusType_ID_Test = 0 func Test_server_LawsuitStatusType_Read(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() ctx := context.Background() Request := grpc_proto.RequestId{} @@ -34,6 +38,8 @@ func Test_server_LawsuitStatusType_Read(t *testing.T) { func Test_server_LawsuitStatusType_Delete(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() ctx := context.Background() Request := grpc_proto.RequestId{} @@ -101,6 +107,8 @@ func Test_server_LawsuitStatusType_Delete(t *testing.T) { func Test_server_LawsuitStatusType_Create(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() var ModelString string m := lawsuit_status_types.LawsuitStatusType{} @@ -129,6 +137,8 @@ func Test_server_LawsuitStatusType_Create(t *testing.T) { func Test_server_LawsuitStatusType_Update(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() ctx := context.Background() Request := grpc_proto.RequestId{} @@ -165,6 +175,8 @@ func Test_server_LawsuitStatusType_Update(t *testing.T) { func Test_server_LawsuitStatusType_Save(t *testing.T) { config_main.LoadEnv() crud_starter.InitCrudTransport_DB() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") + defer postgres_gorm.CloseConnection() ctx := context.Background() Request := grpc_proto.RequestId{} diff --git a/bin/templates/pkg/constants/constants.go_ b/bin/templates/pkg/constants/constants.go_ new file mode 100644 index 0000000..672152c --- /dev/null +++ b/bin/templates/pkg/constants/constants.go_ @@ -0,0 +1,3 @@ +package constants + +const SERVICE_NAME = "sync_service" diff --git a/bin/templates/pkg/db/crud/crud_table_cache_test.go_ b/bin/templates/pkg/db/crud/crud_table_cache_test.go_ index 83b8cb7..f1bd826 100644 --- a/bin/templates/pkg/db/crud/crud_table_cache_test.go_ +++ b/bin/templates/pkg/db/crud/crud_table_cache_test.go_ @@ -3,6 +3,7 @@ package crud_lawsuit_status_types import ( "github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/postgres_gorm" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" "reflect" "testing" ) @@ -11,7 +12,7 @@ func TestReadFromCache(t *testing.T) { var err error config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() //читаем из БД diff --git a/bin/templates/pkg/db/crud/crud_table_update_func_test.go_ b/bin/templates/pkg/db/crud/crud_table_update_func_test.go_ index c630c15..ceab5f1 100644 --- a/bin/templates/pkg/db/crud/crud_table_update_func_test.go_ +++ b/bin/templates/pkg/db/crud/crud_table_update_func_test.go_ @@ -1,7 +1,7 @@ func TestUpdate(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() //прочитаем из БД diff --git a/bin/templates/pkg/db/crud/crud_table_update_test.go_ b/bin/templates/pkg/db/crud/crud_table_update_test.go_ index 386bc00..a08da25 100644 --- a/bin/templates/pkg/db/crud/crud_table_update_test.go_ +++ b/bin/templates/pkg/db/crud/crud_table_update_test.go_ @@ -4,6 +4,7 @@ import ( "github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/postgres_gorm" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" "testing" ) @@ -11,7 +12,7 @@ import ( func TestUpdateManyFields(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() //прочитаем из БД diff --git a/bin/templates/pkg/db/crud/crud_tables_rapira_test.go_ b/bin/templates/pkg/db/crud/crud_tables_rapira_test.go_ index 757e4bb..1c3a609 100644 --- a/bin/templates/pkg/db/crud/crud_tables_rapira_test.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_rapira_test.go_ @@ -4,6 +4,7 @@ import ( "github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/postgres_gorm" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" "testing" ) @@ -12,7 +13,7 @@ const Postgres_ID_Test = 0 func TestRead(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} @@ -33,7 +34,7 @@ func TestRead(t *testing.T) { func TestSave(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} @@ -59,7 +60,7 @@ func TestSave(t *testing.T) { func TestDelete(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} @@ -97,7 +98,7 @@ func TestDelete(t *testing.T) { func TestFind_ByExtID(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} diff --git a/bin/templates/pkg/db/crud/crud_tables_test.go_ b/bin/templates/pkg/db/crud/crud_tables_test.go_ index 5ad2f33..6cfa1c8 100644 --- a/bin/templates/pkg/db/crud/crud_tables_test.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_test.go_ @@ -4,6 +4,7 @@ import ( "github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/postgres_gorm" "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/object_model/entities/lawsuit_status_types" + "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/constants" "testing" ) @@ -12,7 +13,7 @@ const Postgres_ID_Test = 0 func TestRead(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} @@ -33,7 +34,7 @@ func TestRead(t *testing.T) { func TestSave(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} @@ -59,7 +60,7 @@ func TestSave(t *testing.T) { func TestDelete(t *testing.T) { config.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} @@ -74,7 +75,7 @@ func TestDelete(t *testing.T) { func TestFind_ByExtID(t *testing.T) { config_main.LoadEnv() - postgres_gorm.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer postgres_gorm.CloseConnection() crud := Crud_DB{} diff --git a/bin/templates/pkg/db/constants/constants.go b/bin/templates/pkg/db/db_constants/constants.go similarity index 100% rename from bin/templates/pkg/db/constants/constants.go rename to bin/templates/pkg/db/db_constants/constants.go diff --git a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_update_func_test.go_ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_update_func_test.go_ index 9aceaf1..f2e6e20 100644 --- a/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_update_func_test.go_ +++ b/bin/templates/pkg/network/grpc/grpc_client/grpc_client_table_update_func_test.go_ @@ -1,7 +1,7 @@ func TestCrud_GRPC_Update(t *testing.T) { config_main.LoadEnv() - grpc_client.Connect() + postgres_gorm.Connect_WithApplicationName(constants.SERVICE_NAME + "_test") defer grpc_client.CloseConnection() crud := Crud_GRPC{} diff --git a/internal/config/config.go b/internal/config/config.go index 0daf965..471336f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -56,6 +56,8 @@ type SettingsINI struct { TEMPLATES_GRPC_CLIENT_TABLES_CACHE_TEST_FILENAME string TEMPLATES_README_MD_FILENAME string TEMPLATES_README_RUS_FILENAME string + TEMPLATE_FOLDERNAME_CONSTANTS string + TEMPLATES_CONSTANTS_FILENAME string NEED_CREATE_MODEL_STRUCT bool NEED_CREATE_MODEL_CRUD bool NEED_CREATE_DB bool @@ -502,6 +504,16 @@ func FillSettings() { s = Getenv(Name, true) Settings.TEMPLATES_README_RUS_FILENAME = s + // + Name = "TEMPLATE_FOLDERNAME_CONSTANTS" + s = Getenv(Name, true) + Settings.TEMPLATE_FOLDERNAME_CONSTANTS = s + + // + Name = "TEMPLATES_CONSTANTS_FILENAME" + s = Getenv(Name, true) + Settings.TEMPLATES_CONSTANTS_FILENAME = s + } // CurrentDirectory - возвращает текущую директорию ОС diff --git a/internal/create_files/constants_file/constants_file.go b/internal/create_files/constants_file/constants_file.go new file mode 100644 index 0000000..73622c0 --- /dev/null +++ b/internal/create_files/constants_file/constants_file.go @@ -0,0 +1,59 @@ +package constants_file + +import ( + "github.com/ManyakRus/crud_generator/internal/config" + "github.com/ManyakRus/crud_generator/internal/constants" + "github.com/ManyakRus/crud_generator/internal/create_files" + "github.com/ManyakRus/crud_generator/internal/folders" + "github.com/ManyakRus/starter/log" + "github.com/ManyakRus/starter/micro" + "os" + "strings" +) + +// CreateAllFiles - создаёт все файлы в папке grpc proto +func CreateAllFiles() error { + var err error + + err = CreateFileConstants() + if err != nil { + log.Error("CreateFileConstants() error: ", err) + return err + } + + return err +} + +// CreateFileConstants - создаёт 1 файл в папке constants +func CreateFileConstants() error { + var err error + + //чтение файлов + DirBin := micro.ProgramDir_bin() + DirTemplates := DirBin + config.Settings.TEMPLATE_FOLDERNAME + micro.SeparatorFile() + DirReady := DirBin + config.Settings.READY_FOLDERNAME + micro.SeparatorFile() + DirTemplatesConstants := DirTemplates + config.Settings.TEMPLATE_FOLDERNAME_CONSTANTS + micro.SeparatorFile() + DirReadyConstants := DirReady + config.Settings.TEMPLATE_FOLDERNAME_CONSTANTS + micro.SeparatorFile() + FilenameReadyConstants := DirReadyConstants + config.Settings.TEMPLATES_CONSTANTS_FILENAME + FilenameReadyConstants = create_files.DeleteLastUnderline(FilenameReadyConstants) + + //создадим папку готовых файлов + folders.CreateFolder(DirReadyConstants) + + FilenameTemplateConstants := DirTemplatesConstants + config.Settings.TEMPLATES_CONSTANTS_FILENAME + bytes, err := os.ReadFile(FilenameTemplateConstants) + if err != nil { + log.Panic("ReadFile() ", FilenameTemplateConstants, " error: ", err) + } + TextConstants := string(bytes) + + //заменим название сервиса + ServiceNameTemplate := config.Settings.TEMPLATE_SERVICE_NAME + ServiceNameNew := config.Settings.SERVICE_NAME + TextConstants = strings.ReplaceAll(TextConstants, ServiceNameTemplate, ServiceNameNew) + + //запись файла + err = os.WriteFile(FilenameReadyConstants, []byte(TextConstants), constants.FILE_PERMISSIONS) + + return err +} diff --git a/internal/create_files/constants_file/constants_file_test.go b/internal/create_files/constants_file/constants_file_test.go new file mode 100644 index 0000000..a03d70b --- /dev/null +++ b/internal/create_files/constants_file/constants_file_test.go @@ -0,0 +1 @@ +package constants_file diff --git a/internal/create_files/create_files.go b/internal/create_files/create_files.go index ef9eddd..38e5b53 100644 --- a/internal/create_files/create_files.go +++ b/internal/create_files/create_files.go @@ -492,11 +492,20 @@ func FindNRPC_Client_URL() string { return Otvet } -// FindDBConstantsURL - возвращает URL репозитория с пакетом db "constants" +// FindDBConstantsURL - возвращает URL репозитория с пакетом db "db_constants" func FindDBConstantsURL() string { Otvet := "" - Otvet = config.Settings.SERVICE_REPOSITORY_URL + "/" + config.Settings.TEMPLATE_FOLDERNAME_DB + "/" + "constants" + Otvet = config.Settings.SERVICE_REPOSITORY_URL + "/" + config.Settings.TEMPLATE_FOLDERNAME_DB + "/" + "db_constants" + + return Otvet +} + +// FindConstantsURL - возвращает URL репозитория с пакетом pkg "constants" +func FindConstantsURL() string { + Otvet := "" + + Otvet = config.Settings.SERVICE_REPOSITORY_URL + "/" + config.Settings.TEMPLATE_FOLDERNAME_CONSTANTS return Otvet } diff --git a/internal/create_files/crud_tables/crud_tables.go b/internal/create_files/crud_tables/crud_tables.go index babf1aa..8456c25 100644 --- a/internal/create_files/crud_tables/crud_tables.go +++ b/internal/create_files/crud_tables/crud_tables.go @@ -223,6 +223,9 @@ func CreateFilesTest(Table1 *types.Table) error { ModelTableURL := create_files.FindModelTableURL(TableName) TextDB = create_files.AddImport(TextDB, ModelTableURL) + ConstantsURL := create_files.FindConstantsURL() + TextDB = create_files.AddImport(TextDB, ConstantsURL) + //удалим лишние функции TextDB = create_files.DeleteFuncTestDelete(TextDB, Table1) TextDB = create_files.DeleteFuncTestRestore(TextDB, Table1) @@ -719,6 +722,10 @@ func CreateFilesUpdateEveryColumnTest(Table1 *types.Table) error { TextCrud = create_files.ReplacePrimaryKeyM_ID(TextCrud, Table1) TextCrud = create_files.ReplacePrimaryKeyOtvetID(TextCrud, Table1) //TextCrud = create_files.ConvertRequestIdToAlias(TextCrud, Table1) + + ConstantsURL := create_files.FindConstantsURL() + TextCrud = create_files.AddImport(TextCrud, ConstantsURL) + } //создание текста @@ -923,6 +930,9 @@ func CreateFilesCacheTest(Table1 *types.Table) error { //TextCache = create_files.AddImport(TextCache, ModelTableURL) //TextCache = create_files.ConvertRequestIdToAlias(TextCache, Table1) + ConstantsURL := create_files.FindConstantsURL() + TextCache = create_files.AddImport(TextCache, ConstantsURL) + } //замена слов diff --git a/internal/create_files/server_grpc_tables/server_grpc_tables.go b/internal/create_files/server_grpc_tables/server_grpc_tables.go index 6a02b64..cb34edf 100644 --- a/internal/create_files/server_grpc_tables/server_grpc_tables.go +++ b/internal/create_files/server_grpc_tables/server_grpc_tables.go @@ -211,6 +211,9 @@ func CreateFilesTest(Table1 *types.Table) error { CrudStarterURL := create_files.FindCrudStarterURL() TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudStarterURL) + ConstantsURL := create_files.FindConstantsURL() + TextGRPCServer = create_files.AddImport(TextGRPCServer, ConstantsURL) + TextGRPCServer = create_files.CheckAndAddImport(TextGRPCServer, "encoding/json") //Postgres_ID_Test = ID Minimum @@ -584,6 +587,9 @@ func CreateFilesUpdateEveryColumnTest(Table1 *types.Table) error { CrudStarterURL := create_files.FindCrudStarterURL() TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudStarterURL) + ConstantsURL := create_files.FindConstantsURL() + TextGRPCServer = create_files.AddImport(TextGRPCServer, ConstantsURL) + //TextGRPCServer = create_files.ConvertRequestIdToAlias(TextGRPCServer, Table1) } @@ -797,6 +803,9 @@ func CreateFilesCacheTest(Table1 *types.Table) error { CrudStarterURL := create_files.FindCrudStarterURL() TextGRPCServer = create_files.AddImport(TextGRPCServer, CrudStarterURL) + ConstantsURL := create_files.FindConstantsURL() + TextGRPCServer = create_files.AddImport(TextGRPCServer, ConstantsURL) + //замена RequestId{} TextGRPCServer = create_files.ReplaceTextRequestID_PrimaryKey(TextGRPCServer, Table1) diff --git a/internal/logic/logic.go b/internal/logic/logic.go index 2685c3f..d08b902 100644 --- a/internal/logic/logic.go +++ b/internal/logic/logic.go @@ -3,6 +3,7 @@ package logic import ( "github.com/ManyakRus/crud_generator/internal/config" "github.com/ManyakRus/crud_generator/internal/create_files/alias" + "github.com/ManyakRus/crud_generator/internal/create_files/constants_file" "github.com/ManyakRus/crud_generator/internal/create_files/crud_starter" "github.com/ManyakRus/crud_generator/internal/create_files/crud_starter_tables" "github.com/ManyakRus/crud_generator/internal/create_files/crud_tables" @@ -192,5 +193,12 @@ func StartFillAll() error { return err } + //constants + err = constants_file.CreateAllFiles() + if err != nil { + //log.Error("env_file.CreateAllFiles() error: ", err) + return err + } + return err } diff --git a/internal/postgres/postgres.go b/internal/postgres/postgres.go index 7c914b8..e76c1db 100644 --- a/internal/postgres/postgres.go +++ b/internal/postgres/postgres.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/ManyakRus/crud_generator/internal/config" "github.com/ManyakRus/crud_generator/internal/create_files" - "github.com/ManyakRus/crud_generator/internal/mini_func" "github.com/ManyakRus/crud_generator/internal/types" "github.com/ManyakRus/crud_generator/pkg/dbmeta" "github.com/ManyakRus/starter/contextmain" @@ -407,11 +406,16 @@ func FillIDMinimum(MapTable map[string]*types.Table) error { } // - if TypeGo == "string" { - Table1.IDMinimum = `"` + IDMinimum.String + `"` - } else if mini_func.IsNumberType(TypeGo) == true { - Table1.IDMinimum = IDMinimum.String - } + Table1.IDMinimum = IDMinimum.String + //if TypeGo == "string" || TypeGo == "uuid.UUID" { + // Table1.IDMinimum = IDMinimum.String + //} else if mini_func.IsNumberType(TypeGo) == true { + // Table1.IDMinimum = IDMinimum.String + //} else if TypeGo == "time.Time" { + // Table1.IDMinimum = IDMinimum.String + //} else { + // Table1.IDMinimum = IDMinimum.String + //} } return err