Skip to content

UpdateColumnSimple modifies UpdatedAt field #1390

@HydroH

Description

@HydroH
type Model struct {
	gorm.Model
	Num int
}

m := query.Model
m.WithContext(ctx).UpdateColumnSimple(m.Num.Add(1))

Generated SQL:

[0.953ms] [rows:0] UPDATE "models" SET "num"="models"."num"+1,"updated_at"='2025-09-16 10:09:02.34' WHERE "models"."deleted_at" IS NULL

Versions:

	gorm.io/driver/postgres v1.6.0
	gorm.io/gen v0.3.27
	gorm.io/gorm v1.31.0
	gorm.io/plugin/dbresolver v1.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions