Gorm After mysql is updated, return the updated value, using variables

Execute native sql, define variables, and return the updated valuenative sqlUPDATE admin_account SET created_at = @creat...

Gorm Syntax error while formating slice value

go.mod:module gorm-examplego 1.18require ( gorm.io/driver/postgres v1.4.6 gorm.io/gorm v1.24.3)require ( github...

Gorm What is the correct way to lock when using FirstOrCreate?

What is the correct way to lock when using FirstOrCreate?Hi, I'm using FirstOrCreate in order to perform a pretty standa...

Gorm How to preload multiple tables with one id field?

Your QuestionExample: type T1 struct { AnyID uint // it's T2.id if AnyType=1, otherwise it's T3.id AnyType int T2 ...

Gorm BeforeSave hook prevents legitimate updates

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/521DescriptionThis is a bit of an edge case I found: Befo...

Gorm Drop unique constraint on index

Your QuestionI have the following model: type Test struct { ID int64 `gorm:"primaryKey"` Name string `g...

Gorm BeforeUpdate不生效?

Your Questiontype User struct { Name string}func (u *User) BeforeUpdate(*gorm.DB) error { u.Name = "Faker&quo...

Gorm Report if AutoMigrate() will change the schema.

Describe the featureReport if AutoMigrate() will change the schema.One possible way:With Session.DryRun = true, AutoMigr...

Gorm many2many 指定大写的表名无效,关联查询时候自动转换为带下划线的表名

而我实际生成环境的数据库已有的表名是residentOrgsComment From: github-actions[bot]The issue has been automatically marked as stale as it mi...

Gorm How to create a reference without creation of association itself in many-to-many use case

QuestionIs it possible to create a reference without creation of association itself in many-to-many use case?E.g. I have...

Gorm .Pluck() to log correct number of rows returned

Describe the feature.Pluck() should return correct number of rows returned from DBMotivationIn the debug logs of query ...

Gorm Is this a effective way of executing UPDATES with struct?

Is this a effective way of executing UPDATE?The document you expected this should be explainedExpected answerHere is the...

Gorm How increment column version on each modify model via hook?

Hi, I have model and BeforeSave hookfunc (m *User) BeforeUpdate(tx *gorm.DB) (err error) { tx = tx.UpdateColumn(&quot...

Gorm .Pluck() is not logging correct number of rows returned

DescriptionIn the debug logs of query execution, .Pluck() is always printing [0 rows affected or returned ] even though ...

Gorm Custom schema and too long table name generate invalid constraint

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/428DescriptionIt appears that a table name that includes ...

Gorm Modification of string fields to LONGTEXT without a length..

GORM Playground Linkhttps://go.dev/play/p/qkJo3hCfVBNThe link above is created to appease the bot.https://github.com/go-...

Gorm Does gorm support pgxpool?

The default driver used by gorm for Postgres is pgx as per this doc: https://gorm.io/docs/connecting_to_the_database.htm...

Gorm i need insert 5 rows, with colum ID = 0, but gorm neglect 0 values, how to fix this?

i need insert 5 rows, with colum ID = 0, but gorm neglect 0 values, how to fix this?The document you expected this shoul...

Gorm Question: Postgres schema name

File a_day_learn.gopackage mainimport ( "fmt" "gorm.io/driver/postgres" "gorm.io/gorm&...

Gorm How can I use an aggregate function inside SELECT statement ?

Your QuestionHello,Imagine that I have 2 tables Clients and Tickets.So I would like to get a list of clients with a list...
上一页 下一页
.