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 23778f1..721060d 100644 --- a/bin/templates/pkg/db/crud/crud_table_cache_test.go_ +++ b/bin/templates/pkg/db/crud/crud_table_cache_test.go_ @@ -20,13 +20,13 @@ func TestReadFromCache(t *testing.T) { m1.ID = Postgres_ID_Test err = Crud_DB{}.Read(&m1) if err != nil { - t.Errorf("TestReadFromCache() error:t %v", err) + t.Errorf("TestReadFromCache() error:t %w", err) } //читаем из Кеша m2, err := Crud_DB{}.ReadFromCache(Postgres_ID_Test) if err != nil { - t.Errorf("TestReadFromCache() error:t %v", err) + t.Errorf("TestReadFromCache() error: %w", err) } //сравниваем diff --git a/bin/templates/pkg/db/crud/crud_tables.go_ b/bin/templates/pkg/db/crud/crud_tables.go_ index 3a18a2d..6705ccc 100644 --- a/bin/templates/pkg/db/crud/crud_tables.go_ +++ b/bin/templates/pkg/db/crud/crud_tables.go_ @@ -49,7 +49,7 @@ func Read_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.LawsuitS tx := db.First(m) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Read() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Read() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err @@ -206,7 +206,7 @@ func create_update_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types tx = tx.Updates(MapOmit) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Create_Update() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Create_Update() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err @@ -247,7 +247,7 @@ func Restore_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.Lawsu err = Save_ctx(ctx, db, &m2) if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Restore() ColumnNamePK: %v, error: %v", ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Restore() ColumnNamePK: %v, error: %w", ColumnNamePK, err) } return err @@ -293,7 +293,7 @@ func Find_ByExtID_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types. tx := db.Where("ext_id = ?", m.ExtID).Where("connection_id = ?", m.ConnectionID).First(m) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Find_ByExtID() ExtID: %v, ConnectionID: %v, error: %v", m.ExtID, m.ConnectionID, err) + err = fmt.Errorf(m.TableNameDB()+" Find_ByExtID() ExtID: %v, ConnectionID: %v, error: %w", m.ExtID, m.ConnectionID, err) } return err @@ -329,7 +329,7 @@ func Delete_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.Lawsui tx := db.Delete(m) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Delete() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Delete() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err diff --git a/bin/templates/pkg/db/crud/crud_tables_rapira.go_ b/bin/templates/pkg/db/crud/crud_tables_rapira.go_ index 1ff96b0..818defd 100644 --- a/bin/templates/pkg/db/crud/crud_tables_rapira.go_ +++ b/bin/templates/pkg/db/crud/crud_tables_rapira.go_ @@ -49,7 +49,7 @@ func Read_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.LawsuitS tx := db.First(m) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Read() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Read() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err @@ -206,7 +206,7 @@ func create_update_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types tx = tx.Updates(MapOmit) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Create_Update() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Create_Update() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err @@ -247,7 +247,7 @@ func Delete_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.Lawsui err = Save_ctx(ctx, db, &m2) if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Delete() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Delete() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err @@ -288,7 +288,7 @@ func Restore_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types.Lawsu err = Save_ctx(ctx, db, &m2) if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Restore() ColumnNamePK: %v, error: %v", m.ColumnNamePK, err) + err = fmt.Errorf(m.TableNameDB()+" Restore() ColumnNamePK: %v, error: %w", m.ColumnNamePK, err) } return err @@ -334,7 +334,7 @@ func Find_ByExtID_ctx(ctx context.Context, db *gorm.DB, m *lawsuit_status_types. tx := db.Where("ext_id = ?", m.ExtID).Where("connection_id = ?", m.ConnectionID).First(m) err = tx.Error if err != nil { - err = fmt.Errorf(m.TableNameDB()+" Find_ByExtID() ExtID: %v, ConnectionID: %v, error: %v", m.ExtID, m.ConnectionID, err) + err = fmt.Errorf(m.TableNameDB()+" Find_ByExtID() ExtID: %v, ConnectionID: %v, error: %w", m.ExtID, m.ConnectionID, err) } return err diff --git a/bin/templates/pkg/db/crud_functions/crud_functions_test.go b/bin/templates/pkg/db/crud_functions/crud_functions_test.go index 4763c13..5b1b27b 100644 --- a/bin/templates/pkg/db/crud_functions/crud_functions_test.go +++ b/bin/templates/pkg/db/crud_functions/crud_functions_test.go @@ -11,7 +11,7 @@ func TestMapOmit_from_MassOmit(t *testing.T) { MassOmit := []string{} result := MapOmit_from_MassOmit(MassOmit) if len(result) != 0 { - t.Errorf("Expected an empty map, but got %v", result) + t.Errorf("Expected an empty map, but got %w", result) } }) diff --git a/bin/templates/pkg/object_model/entities/model_crud.go_ b/bin/templates/pkg/object_model/entities/model_crud.go_ index 222bf15..07bafd6 100644 --- a/bin/templates/pkg/object_model/entities/model_crud.go_ +++ b/bin/templates/pkg/object_model/entities/model_crud.go_ @@ -27,7 +27,7 @@ type ICrud_LawsuitStatusType interface { UpdateManyFields(*LawsuitStatusType, []string) error } -// TableName - возвращает имя таблицы в БД +// TableNameDB - возвращает имя таблицы в БД func (m LawsuitStatusType) TableNameDB() string { return "lawsuit_status_types" }