feat: update func
This commit is contained in:
@@ -83,20 +83,22 @@ func (m *Orders) BatchForceDelete(ctx context.Context, ids []int64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Orders) Update(ctx context.Context) error {
|
||||
m.UpdatedAt = time.Now()
|
||||
// func (m *Orders) Update(ctx context.Context) error {
|
||||
//
|
||||
// m.UpdatedAt = time.Now()
|
||||
//
|
||||
|
||||
stmt := table.Orders.UPDATE(table.Orders.MutableColumns.Except(ordersUpdateExcludeColumns...)).SET(m).WHERE(table.Orders.ID.EQ(Int(m.ID))).RETURNING(table.Orders.AllColumns)
|
||||
m.log().WithField("func", "Update").Info(stmt.DebugSql())
|
||||
// stmt := table.Orders.UPDATE(table.Orders.MutableColumns.Except(ordersUpdateExcludeColumns...)).SET(m).WHERE(table.Orders.ID.EQ(Int(m.ID))).RETURNING(table.Orders.AllColumns)
|
||||
// m.log().WithField("func", "Update").Info(stmt.DebugSql())
|
||||
|
||||
if err := stmt.QueryContext(ctx, db, m); err != nil {
|
||||
m.log().WithField("func", "Update").Errorf("error updating Orders item: %v", err)
|
||||
return err
|
||||
}
|
||||
// if err := stmt.QueryContext(ctx, db, m); err != nil {
|
||||
// m.log().WithField("func","Update").Errorf("error updating Orders item: %v", err)
|
||||
// return err
|
||||
// }
|
||||
|
||||
m.log().WithField("func", "Update").Infof("Orders item updated successfully")
|
||||
return nil
|
||||
}
|
||||
// m.log().WithField("func", "Update").Infof("Orders item updated successfully")
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// GetByCond
|
||||
func (m *Orders) GetByCond(ctx context.Context, conds ...Cond) (*Orders, error) {
|
||||
|
||||
Reference in New Issue
Block a user