Gorm Find执行多次,会把sql拼接

我在循环里面查找数据,为什么把上一次的in条件会拼在一起?我想要的是每一个都新的单独查询,用什么方式。code:for _, userGroup := range userGroups { users := make([]*model...

Gorm batch update by object list

Your Questiongorm version: gorm.io/gorm v1.20.6I want to batch update some fields of the object list. Like:model.objects...

Gorm How to join table and return data in JSON format

How to join table and return data in JSON formatI have two tablestype Menu struct { ID int gorm:"pri...

Gorm 求助一个问题:关于1对多表时候,如何双向索引对方?

Your Question比如:// User 属于 Company,CompanyID 是外键type User struct { gorm.Model Name string CompanyID int Company...

Gorm db.AutoMigrate(&MyTest{}) 时会报错

背景信息:go:1.18gorm:1.23.8sqlite3结构体如下type MyTest struct { Name string `gorm:"default:中文"` gorm.Model}在首次运行...

Gorm [Bug] Got wrong value in Find/Scan with JOIN and same column name

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/516DescriptionGot wrong value in Find/Scan with JOIN and ...

Gorm Performing multiple migrations ends up in prepared statement cache error

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/523DescriptionWhen Prepared Statements are enabled in gor...

Gorm gorm.v1 一个字段上定义多个联合索引tag,只有一个生效

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1Description版本V1Model定义如下:type Demo struct { ID ...

Gorm SqlServer scan rows to map[string]interface,type DECIMAL is string

GORM Other Playground Linkgo-gorm/playground#337SqlServer: scan rows to map[string]interface,type DECIMAL is string and ...

Gorm Is there a way to use GROUP BY truncating a DATE field?

Your QuestionI'm trying to use the Count finisher in order to get the amount of rows by day. The problem is that the col...

Gorm when the data is empty, json parsing fails !!

type AppLoginLog struct { Id uint `gorm:"column:id;" json:"id"` Json...

Gorm Creating models does not work

Hello,I have some code to create a todo. but it doesnt work.type Todo struct { ID uintgorm:"primary key;autoIncrement...

Gorm 批量插入生成的SQL报错

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1DescriptionComment From: github-actions[bot]The issue ha...

Gorm Plan for migration generation tool

Describe the featureIs there any plan for creating a tool to generate migration files from DB (just like django does) to...

Gorm 插入数据,如何获取自动递增id?

Your Question通过map[string]interface{}插入数据,如何获取自动递增id有没有比较简单的方法实现The document you expected this should be explainedExpect...

Gorm Logger shows invalid log (only the log is wrong, the insertion is fine)

Logger shows invalid log (only the log is wrong, the insertion is fine)When I try to insert a user with lots of fields, ...

Gorm mysql 连接池设置了连接可复用最大时间时,超出时间的连接并没有被close掉

`// 获取通用数据库对象 sql.DB ,然后使用其提供的功能sqlDB, err := db.DB()// SetMaxIdleConns 用于设置连接池中空闲连接的最大数量。sqlDB.SetMaxIdleConns(10)// Se...

Gorm SetColumn doesn't work as expected in BeforeSave and BeforeUpdate hooks

Hi jinzhu,i'm experiencing a problem with setting values using the BeforeSave and BeforeUpdate hooks while updating the ...

Gorm gorm connet mycat get text value question

when i use gorm connet mycat, get the text field value is incorrectComment From: github-actions[bot]The issue has been a...

Gorm Official documentation has errors

The tag in the source code is primarykey refer to https://github.com/go-gorm/gorm/blob/master/model.goBut in the documen...
上一页 下一页
.