Gorm when struct table dependent on its value, TableName method is invalid

GORM Playground Linki have a struct type Logs struct { ID int64 gorm:"id" Content string gorm:"content" LogTime int64 go...

Gorm 我希望在gorm执行某些sql语句时,如果发生异常,则将执行的SQL打印到日志中

我希望在gorm执行某些sql语句时,如果发生异常,则将执行的SQL打印到日志中我的代码如下示例result := db.Find(&regionModels)if err := result.Error; err != nil {...

Gorm string in 'numeric' field

Intentionally no playground link.gorm puts a string such as "true" in a SQLite 'numeric' field when mapping a go bool an...

Gorm the field which is selected can not be updated

just as the pictures, the filed using_assistant is selected, but it count be updatedComment From: github-actions[bot]The...

Gorm Is there a unit test coverage for gorm?

Hi,We are investigating gorm and considering using it, just wondering what is the current test coverage of the code base...

Gorm 在使用SQLlite数据库进行AutoMigrate时,ID属性无法设置auto_increment

Your Question我在使用自动创建表的功能时,对所有表的ID属性需要设置自增,我创建了一个根结构体type Model struct { ID uint `json:"id" gor...

Gorm Why uint instead of int?

I can see that gorm.Model is:type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time ...

Gorm How to create foreign key for embedded hasmany relation during migration?

Your QuestionHow to create foreign key for embedded hasmany relation during migration? For example:type VirtualMachine s...

Gorm gorm的hasIndex函数获取不到阿里云PolarDB-X 2.0的表内的索引

在使用casbin v2.71.1 和casbin/gorm-adapter/v3 v3.18.0的时候,数据库使用的是阿里云PolarDB-X 2.0 mysql ,在调用到hasIndex函数的时候查询不到唯一索引的存在下边是我手动查询...

Gorm How to target a different model (in other word, table) once a global hook is triggered?

Your QuestionWhen a hook registered at global is triggered, it seems the db object is scoped to the impacted model only....

Gorm Regression using Find and Updates

https://github.com/go-gorm/playground/pull/655DescriptionI upgraded from 1.24.6 to 1.25.5 and some of my gorm queries ar...

Gorm db.Order(gorm.Expr(" id, ?", IDs)) // sql expression

GORM Playground Link在原来 github.com/jinzhu/gorm 的项目中有db.Order(gorm.Expr("id, ?", []int{1, 2, 3})) // sql expression这样的一种写...

Gorm if table field created_at have a default tag ,gorm will not auto fill value

type TableTest struct { Id int64 `gorm:"column:id;primary_key;AUTO_INCREMENT" json:...

Gorm ErrRecordNotFound not work for Find()?

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/573run test code below can reproduce thisDo I miss someth...

Gorm same filed different type on scan

Your QuestionI have two table,same filed same go enumExpected answerwhen i do query.first table src is []byte.so case fa...

Gorm Concurrent AutoMigrate

Your QuestionI want to know such a thing.I am developing a service and I use AutoMigrate at startup (I can't during pipe...

Gorm Unexpected TableName parsing behaviour

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/648DescriptionWhen gorm parses the table names from the m...

Gorm Can't Insert correct boolean when default is true

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1Descriptionboolean value can't conver to correct value w...

Gorm 一个表有若干字段,每次更新不一定更新某几个字段,如何实现增量更新?

Your QuestionThe document you expected this should be explainedExpected answerComment From: wxy2077问题描述太少了,没有例子,是我理解的这个意...

Gorm Create table based on struct

Your QuestionHello there. I would like to know if there is a way to create a object table based on struct with gorm.The ...
上一页 下一页
.