Gorm Association

//datasource.MysqlConn.Model(&entity.Role{}).Where(&entity.Role{ID: id}).Association("Permissions"...

Gorm Add documentation for nested join and embedded preload

Describe the featureAdd documentation for nested join and embedded preloadMotivationNow gorm support nested join and emb...

Gorm 升级以后,插入数据以后自增主键id未返回

https://github.com/LiveAlone/playgroundgrom 版本升级 1.21.13 升级到 1.24.6 版本时候, 发现Insert 返回主键Id 不对。 我的model 定义type User struct...

Gorm AutoMigrate already exists bug

var db *gorm.DBdb, err = gorm.Open(mysql.Open(dbAddress), &gorm.Config{})db.AutoMigrate(Camera{})db.AutoMigrate(Sequ...

Gorm 不确认是否是一个BUG,关于JSONB类型存储时,被自动base64加密(加密后也无法正常反溯)

版本gorm.io/gorm v1.24.5 中出现问题gorm.io/gorm v1.21.12 中正常环境使用postgresql 15版本有如下JSONB类型type StringArray []bytefunc (j *String...

Gorm Transaction Problem - single connection in restful api but a transaction can be only used once

Your QuestionI am using GIN framework and Gorm to write restful APIs with Clean Architecture pattern in different layers...

Gorm Generated column should not be altered during automigration

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/496DescriptionOnce a generated column is created in postg...

Gorm How to Use 1-Many (yes, I read the docs carefully)

Your QuestionI'm at a loss how to make this work. I've extensively experimented, and reviewed the documentation, and I'm...

Gorm Transaction(事务)在restful api中的使用后导致别的api会有问题

Your Question我正在使用 GIN 框架和 Gorm 写restful api(结构分有controller、usecase、repository、domain), 但是发现如果我在其中一个API中的函数中使用transactio...

Gorm 不执行SQL查询,重启后可以恢复,数据库是阿里云MySQL5.6

GORM Playground Linkfunc GetInstance() *gorm.DB { host := viper.GetString("mysql.default.hostname") user := viper....

Gorm 批量插入不成功,也没收到提示,这方面是否可以优化。

使用postgreSQL15数据库,go环境是1.20.3批量生成测试数据,代码如下,发现生成1000条的时候插入可以成功,但循环一万次的时候,并没有数据插入,也没有提示插入失败。我不知道是postgreSQL15单次插入有数量上限,还是g...

Gorm The query result is bound incorrectly when multiple tables have the same field name

A structure nested multiple models,The same field name exists with each other,cannot be used normallyhow to resolve?Comm...

Gorm 如果我想要多级关联的话我应该怎么做?

如果我想要多级关联的话我应该怎么做?假设我有个文件表又有一个文件数据表他与文件表是多对一的关系并且文件数据表为多这个时候业务通常是通过关联文件数据表来获取文件的uri。例如用户有一个头像。这时如果我想通过查询用户同时将用户头像的uri查询出...

Gorm Error 1062 (23000): Duplicate entry 'xx' for key 'PRIMARY'

在并发多协程调用gorm的Create方法时,会对主键报错误:Error 1062 (23000): Duplicate entry 'xx' for key 'PRIMARY'求问这是为什么?gorm版本:master最新go版本:1.1...

Gorm unsupported Scan, storing driver.Value type []uint8 into type *time.Time

问题描述unsupported Scan, storing driver.Value type []uint8 into type *time.Time问题原因当Mysql的字段类型为time时,即使在dns中添加parseTime=tru...

Gorm save()需要条件,默认不是使用id作为查询条件,没有就创建吗?

Your Questionsave()需要条件,默认不是使用id作为查询条件,没有就创建吗?Model不应该是选择模型/表,不参与查询吗?实例代码var user model.Userdb := gorm.DB.Model(&mod...

Gorm Delete with select Hook BeforeDelete AfterDelete

When deleting, the hook will be triggered, but the hook entity object attribute has not been assignedfunc x(err error) {...

Gorm encountering the error when connecting with database by gorm.Open should not print a error log

Your QuestionWhen using docker compose start mysql and app, because mysql init need some time, gorm.Open will throw erro...

Gorm FirstOrCreate is not atomic

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/590DescriptionI tried running FirstOrCreate in multiple t...

Gorm 升级到最新版本v0.3.22,实体注释少了

生成实体缺少注释如以前版本生成type WeixinRequestRule struct { RuleID int64 `gorm:"column:rule_id;type:bigint;primaryK...
上一页 下一页
.