Gorm 朱建ID 查询用什么 ?First()??有bug 后面会跟上 ORDER BY bv.id LIMIT 1

d := new(BVData)err := gormDB.First(d, id).Error生成的 sql WHERE bv.id = '10180827' ORDER BY bv.id LIMIT 1有没有考虑单独搞个 朱建的查询写法...

Gorm 插入数据的时候如何将字段值为空,例如string 类型字段的值为"",int 类型字段的值为0这样的数据插入。目前看起来使用struct插入会自动过滤

Your QuestionThe document you expected this should be explainedExpected answerComment From: xiashaohua发现是这段代码导致的for _, f...

Gorm use limit with preload

Hello I have Room and Messages tables where where room has many messages. I want to get user rooms with limit 20 rooms a...

Gorm Association on SQLite gives unsupported data type: <nil>

Your QuestionHi, I am getting an unsupported data type: &lt;nil&gt; while trying to retrieve associated data. I can see ...

Gorm field tag scale not work

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/268DescriptionI added a float64 field named Points to the...

Gorm [skiphooks] can not work for preload Associations anymore in v1.23.5

GORM Playground Link(https://github.com/cxiang03/playground/commit/c02ce1c4d7ec866aac67b2cc6d7338e632a0bfa9)Descriptions...

Gorm Simple insert into many2many

Using gorm v2.The modelstype Organization struct { ID uint `gorm:&quot;column:id;primaryKey&quot;` Nam...

Gorm db.First 生成错误的SQL

type User struct { ID string}如下代码生成的SQL:user := &amp;User{}db.First(user, &quot;123456&quot;)SELECT * FROM `user` WHE...

Gorm Column does not implement gorm.ColumnType (missing AutoIncrement method)

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1Descriptiongo.mod are discribed as below gorm.io/driver/...

Gorm [bug]reflect: reflect.Value.Set using unaddressable value....goexit: BYTE $0x90 // NOP

[GIN-debug] Listening and serving HTTP on :80812022/04/30 17:08:53 {&quot;ID&quot;:0,&quot;CreatedAt&quot;:&quot;0001-01...

Gorm Gorm not retrieving data from associated table

I'm working on a Gin app using Gorm with MySQL. In order to define a belongs to relationship in a Gorm Model, you have t...

Gorm bug: AutoMigrate with special table name

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/471DescriptionI don't know if this is a bug or an unsuppo...

Gorm gorm returns gorm.ErrRecordNotFound even though the ID is the DB

Hello, we are seeing something very concerning with this code:u := User{ID: &quot;EXISTING_STRING_ID_IN_THE_DB&quot;}err...

Gorm Commit / Rollback Should Return Error

Describe the featureCommit and rollback should return an error and not the DB instance.MotivationIn Go, it's common to u...

Gorm ERROR: rows to struct with an interface{} field

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/468DescriptionHave a struct that has couple of fields of ...

Gorm Question: How do I use Changed in BeforeUpdate to track changes on a field in an embedded struct?

QuestionHow do I use Changed in BeforeUpdate to track changes on a field in an embedded struct? I tried Changed("field1-...

Gorm Question: custom log context

My english is so poor, article translated with Google Translate.Form is nested in Gin. Because there is some chain infor...

Gorm Add Close function for gorm.DB

Describe the featuregorm.DB创建出来之后也是需要关闭的。如果不关闭,程序退出时mysql会打印类似下面的日志2022-04-10T03:27:09.414539Z 25 [Note] Aborted connect...

Gorm gorm

Questions about the Paginate function of GORM's Scopescode:func main () { if err:= initDB(); err !=nil{ fmt.P...

Gorm FindInBatches in an unexpected manner with limit or offset in original query

GORM Playground LinkIt's a reversed test, which means the CI SHOULD FAIL instead of success.https://github.com/go-gorm/p...
上一页 下一页
.