feat: update jobs

This commit is contained in:
Rogee
2025-05-07 20:48:43 +08:00
parent e923f8c7c5
commit 1199118fb4
5 changed files with 27 additions and 15 deletions

View File

@@ -164,11 +164,19 @@ func (m *usersModel) Update(ctx context.Context, id int64, userModel *model.User
userModel.UpdatedAt = time.Now()
tbl := table.Users
stmt := tbl.UPDATE(tbl.MutableColumns.Except(tbl.CreatedAt, tbl.DeletedAt)).MODEL(userModel).WHERE(tbl.ID.EQ(Int64(id))).RETURNING(tbl.AllColumns)
stmt := tbl.
UPDATE(
tbl.MutableColumns.Except(
tbl.CreatedAt,
tbl.DeletedAt,
),
).
MODEL(userModel).
WHERE(tbl.ID.EQ(Int64(id))).
RETURNING(tbl.AllColumns)
m.log.Infof("sql: %s", stmt.DebugSql())
var updatedUser model.Users
if err := stmt.QueryContext(ctx, db, &updatedUser); err != nil {
m.log.Errorf("error updating user: %v", err)
return nil, err