Gorm How to enforce hooks on every query?

Your QuestionI have a BaseModel that has a GetDefaultFilters method. All my models implement BaseModel. GetDefaultFilter...

Gorm fatal error: concurrent map writes in "parseRelation" function

We found that two tables, both associated with the same table, were called at the same time when the program was started...

Gorm AutoMigrate函数迁移sqlite数据库表失败

GORM Playground Linkhttps://github.com/go-gorm/gorm/releases/tag/v1.25.12Description1.已经存在了一个sqlite3数据库,表结构已经通过sql语句被建立好...

Gorm *gorm.DB和*query.Query混合使用的最佳实践

Your Question两者的文档都看过,gen的文档主要在于演示对于原生gorm的封装,展示各种便利性,并没有体现两者之间混合使用的场景。一个实际的场景是:最初使用了gorm,后来渐进式使用gen替换一部分gorm,两者共同存在。另外的...

Gorm Duplicate savepoint names resulting in partial rollbacks in nested transactions

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/757DescriptionWhen you wrap db.Transaction, go will only ...

Gorm gorm 使用shardingsphere做分表,新增数据时时报了如下错误

首先:在navicat直接连接shardingsphere,执行新增语句是没有这个错误的,使用gorm执行这个语句就会有这个图一的错误Comment From: github-actions[bot]The issue has been a...

Gorm Possibility to set custom names to PK

Describe the featureAllow custom names to be set for primary keys.MotivationIn other ORMs there is possibility to set cu...

Gorm Struct Tags/Fields Tags not work when call db.AutoMigrate()

ENV:go version go1.22.8 darwin/amd64"gorm.io/driver/sqlite v1.4.4""gorm.io/gorm v1.25.12"Define the model for sqlite tab...

Gorm When using embedded structure query, the result is not consistent with the expectation

Your QuestionI have two model structs. When I combine these two structs for querying, a problem occurs.The document you ...

Gorm 请问怎么在关联查询中添加查询条件?

例如: model := &models.User{} err = tx. Model(model ). Preload("Posts", func(db *gorm.DB...

Gorm autoUpdateTime and default seem to be conflicting

autoUpdateTime and default seem to be conflictingAs defined in the gorm documentation. I set the default value of these ...

Gorm https://gorm.io Unable to access

DescriptionComment From: jinzhuseems it is caused by some issues of cloudflare, just fixed it.thank you for your report.

Gorm How to get sql statement

Your QuestionHow to get SQL statement before runI tried to use db.Statement.SQL.String() and db.Session(&gorm.Sessio...

Gorm OpenGauss DB support

Hi,at present, our projects using gorm need to use Huawei OpenGauss db, but there is no official driver supporting OpenG...

Gorm Transaction update RowsAffected is 0

Transaction update RowsAffected is 0Just like the following code, when it updates, RowsAffected is 0What version of Go a...

Gorm mysql biginto to golang int64 or []uint8

Your Question`type Status int// Scan 实现 Scanner 接口,用于将数据库的值映射到枚举类型func (s Status) Scan(value any) error {switch v := val...

Gorm MySQL create 默认值这样不符合文档描述吧? (column default value)

Your QuestionType Model struct { UID int `gorm:"primaryKey"` Swtich1 int Swtich2 int}func CreateModel...

Gorm How add after commit callbacks

Your QuestionHow can I have GORM2 add after commit callbacks? I understand how to do it after an insert, update, delete ...

Gorm AutoMigrate Does Not Update Existing Check Constraint

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/760DescriptionSummary:When modifying a check constraint o...

Gorm GORM save to map seems to require a model even though the table name is being specified

Your QuestionIn using the "Find to Map" feature it seems that even when specifying the table name a model is still requi...
上一页 下一页
.