From b1df27bd893b503abac053232205e5c18269595e Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Wed, 14 Feb 2024 17:30:09 +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 --- bin/templates/pkg/db/crud/crud_table_update_func.go_ | 2 +- internal/create_files/db_crud_tables/db_crud_tables.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/templates/pkg/db/crud/crud_table_update_func.go_ b/bin/templates/pkg/db/crud/crud_table_update_func.go_ index 4632daa..096bd13 100644 --- a/bin/templates/pkg/db/crud/crud_table_update_func.go_ +++ b/bin/templates/pkg/db/crud/crud_table_update_func.go_ @@ -30,7 +30,7 @@ func (crud Crud_DB) Read_ctx(ctx context.Context, m *lawsuit_status_types.Lawsui db.WithContext(ctx) // - tx := db.Model(&m).Update("Name", m.ID) + tx := db.Model(&m).Update("ColumnName", m.ColumnName) err = tx.Error if err != nil { err = fmt.Errorf("Read() id: %v, error: %v", m.ID, err) 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 14db937..77736f4 100644 --- a/internal/create_files/db_crud_tables/db_crud_tables.go +++ b/internal/create_files/db_crud_tables/db_crud_tables.go @@ -583,8 +583,7 @@ func FindTextUpdateEveryColumn1(TextCrudUpdateFunc string, Table1 *types.Table, Otvet = strings.ReplaceAll(Otvet, "ColumnName", ColumnName) Otvet = strings.ReplaceAll(Otvet, "Model.ID", "Model."+ColumnName) Otvet = strings.ReplaceAll(Otvet, "Request.ID", "Request."+TextRequestFieldName) - Otvet = strings.ReplaceAll(Otvet, " Name ", " "+ColumnName+" ") - Otvet = strings.ReplaceAll(Otvet, `"Name"`, `"`+ColumnName+`"`) + //Otvet = strings.ReplaceAll(Otvet, "ColumnName", ColumnName) //Otvet = strings.ReplaceAll(Otvet, "m.ID", "m."+ColumnName) return Otvet @@ -619,7 +618,6 @@ func CreateTestFilesUpdateEveryColumn(Table1 *types.Table) error { TextCrud := "package " + config.Settings.PREFIX_CRUD + TableName + "\n\n" TextCrud = TextCrud + `import ( "testing" - "errors" "github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/postgres_gorm" )