mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2024-11-27 08:40:53 +02:00
сделал %w
This commit is contained in:
parent
743bf2a146
commit
b41c2c83c0
@ -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)
|
||||
}
|
||||
|
||||
//сравниваем
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -27,7 +27,7 @@ type ICrud_LawsuitStatusType interface {
|
||||
UpdateManyFields(*LawsuitStatusType, []string) error
|
||||
}
|
||||
|
||||
// TableName - возвращает имя таблицы в БД
|
||||
// TableNameDB - возвращает имя таблицы в БД
|
||||
func (m LawsuitStatusType) TableNameDB() string {
|
||||
return "lawsuit_status_types"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user