1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00

сделал CreateFilesUpdateEveryColumn()

This commit is contained in:
Nikitin Aleksandr 2024-02-14 17:30:09 +03:00
parent 17ff7e25c7
commit b1df27bd89
2 changed files with 2 additions and 4 deletions

View File

@ -30,7 +30,7 @@ func (crud Crud_DB) Read_ctx(ctx context.Context, m *lawsuit_status_types.Lawsui
db.WithContext(ctx) db.WithContext(ctx)
// //
tx := db.Model(&m).Update("Name", m.ID) tx := db.Model(&m).Update("ColumnName", m.ColumnName)
err = tx.Error err = tx.Error
if err != nil { if err != nil {
err = fmt.Errorf("Read() id: %v, error: %v", m.ID, err) err = fmt.Errorf("Read() id: %v, error: %v", m.ID, err)

View File

@ -583,8 +583,7 @@ func FindTextUpdateEveryColumn1(TextCrudUpdateFunc string, Table1 *types.Table,
Otvet = strings.ReplaceAll(Otvet, "ColumnName", ColumnName) Otvet = strings.ReplaceAll(Otvet, "ColumnName", ColumnName)
Otvet = strings.ReplaceAll(Otvet, "Model.ID", "Model."+ColumnName) Otvet = strings.ReplaceAll(Otvet, "Model.ID", "Model."+ColumnName)
Otvet = strings.ReplaceAll(Otvet, "Request.ID", "Request."+TextRequestFieldName) Otvet = strings.ReplaceAll(Otvet, "Request.ID", "Request."+TextRequestFieldName)
Otvet = strings.ReplaceAll(Otvet, " Name ", " "+ColumnName+" ") //Otvet = strings.ReplaceAll(Otvet, "ColumnName", ColumnName)
Otvet = strings.ReplaceAll(Otvet, `"Name"`, `"`+ColumnName+`"`)
//Otvet = strings.ReplaceAll(Otvet, "m.ID", "m."+ColumnName) //Otvet = strings.ReplaceAll(Otvet, "m.ID", "m."+ColumnName)
return Otvet return Otvet
@ -619,7 +618,6 @@ func CreateTestFilesUpdateEveryColumn(Table1 *types.Table) error {
TextCrud := "package " + config.Settings.PREFIX_CRUD + TableName + "\n\n" TextCrud := "package " + config.Settings.PREFIX_CRUD + TableName + "\n\n"
TextCrud = TextCrud + `import ( TextCrud = TextCrud + `import (
"testing" "testing"
"errors"
"github.com/ManyakRus/starter/config_main" "github.com/ManyakRus/starter/config_main"
"github.com/ManyakRus/starter/postgres_gorm" "github.com/ManyakRus/starter/postgres_gorm"
) )