Nineya
Home
Blog
软著申请
Gorm SQL语句多出表名前缀
2025-01-14 08:41:24
749
Your Question多个项目共用一套Models,之前是在各个项目中分别AutoMigrate(),为了统一我将AutoMigrate()独立成单独的应用,但是这样导致了一些问题:SELECT * FROM `suppliers` W...
Gorm Use TableName to specify the database for the Create operation, but Create will ignore my database name
2025-01-14 08:41:21
1587
Description:I use 'Attach DATABASE' to attach the databaseerr = db.Exec("ATTACH DATABASE '" + dsnInfo + "' AS info").Err...
Gorm Understanding Foreign Keys/One-to-Many
2025-01-14 08:41:15
4346
How can I use 1 - Many RelationshipsI'm at a loss how to make this work. I've extensively experimented, and reviewed the...
Gorm How to add Limit, Offset and Order By clause to Raw chain method?
2025-01-14 08:41:12
1370
Your QuestionThe query that I am trying is err = gdb.Raw(sqlQuery, qp.WhereArgs...).Offset(qp.Offset).Limit(qp.Limit).Or...
Gorm model value required when using preload
2025-01-14 08:41:10
965
When I run tx.Preload, get error: "model value required when using preload"tx *gorm.DB tx = tx.Preload("Tags"...
Gorm Why does the OR method exist, But not the AND method?!
2025-01-14 08:41:07
1398
Why does the OR method exist, But not the AND method?!https://gorm.io/docs/query.html#Or-ConditionsComment From: github-...
Gorm FindInBatches over Offset instead of Primary Key increments
2025-01-14 08:41:05
2302
Actually find in Batches works using the primary key as an increment, so it assumes that the Batch is sorted with the Pr...
Gorm update使用子查询
2025-01-14 08:41:02
697
UPDATE phone SET user_id=2, share=0 where (SELECT id FROM phone WHERE share = 1 LIMIT 1)这样的sql用gormv2 要怎么写呢...Comment Fr...
Gorm Disable Timestamp Tracking is not working as is documented?
2025-01-14 08:40:59
1015
Your QuestionI have this model:type sqlModel struct { Id string `gorm:"primaryKey"` Product...
Gorm False value in where clause ignored
2025-01-14 08:40:57
1426
I'm running in to an issue I'll detail with a brief example:// Example modeltype Example struct { gorm.Model Value...
Gorm A limit of zero returns the wrong results
2025-01-14 08:40:54
6028
GORM Playground Linkhttps://github.com/go-gorm/playground/pull/522DescriptionSpecifying a limit of 0 results in all rows...
Gorm Please reopen #4946
2025-01-14 08:40:51
908
Referencing another ticket that a lot of people have commented on recently and trying to have it reopened. So as to avoi...
Gorm Add the JSON support for SQLite
2025-01-14 08:40:49
336
Describe the featureSQLite now supports JSON type.Please refer to https://www.sqlite.org/json1.htmlMotivationSQLite No 1...
Gorm Nested preload with limit
2025-01-14 08:40:46
7263
Your QuestionI want to perform a limit on a nested preload to improve performance. The limit works on the total count on...
Gorm How to get the number of affected rows actually inserted when using the FirstOrCreate method
2025-01-14 08:40:44
1782
V1.24.6 result := db.Where(entity.SysClientUser{Email: "sun"}).FirstOrCreate(&entity.SysClientUser{Email: "test"}...
Gorm 使用errgroup并发查询时报错
2025-01-14 08:40:41
3256
问题: 当我使用errgroup并发读数据库时发生了panic报错信息:fatal error: concurrent map writesgoroutine 2183 [running]:runtime.throw(0x2168afc, ...
Gorm Save (probably) should be idempotent
2025-01-14 08:40:39
2737
According to https://gorm.io/docs/update.html#Save-All-Fields"Save is a combination function. If save value does not con...
Gorm How to update created_at manually
2025-01-14 08:40:36
719
I tried db.DB.Exec("UPDATE thread SET created_at = ? WHERE id = ?", time.Now(), id) but seems this method dose not work ...
Gorm Preload associations inside embedded fields
2025-01-14 08:40:33
1277
GORM Playground Linkhttps://github.com/go-gorm/playground/pull/576DescriptionIn our application we'd like to have a simi...
Gorm AutoMigrate ignore "where" conditions on unique index for SQLite
2025-01-14 08:40:31
402
GORM Playground Linkhttps://github.com/go-gorm/playground/pull/581DescriptionI create uniq index with condition on value...
上一页
下一页
1
…
956
957
958
959
960
…
2246
.