Gorm Unnecessarily unique indexes created when running AutoMigrate

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/589DescriptionModel User has only one field Name, with un...

Gorm Refactor: Distinguish between unique and UniqueIndex

Describe the featureDistinguish between unique index and index to better support them.MotivationBecause we can't disting...

Gorm How to properly BEGIN EXCLUSIVE TRANSACTION using sqlite driver?

Your QuestionWhat is the proper way to run BEGIN EXCLUSIVE TRANSACTION when using sqlite?The database/sql package doesn'...

Gorm Error in GORM migration: GuessConstraintInterfaceAndTable undefined

When attempting to run my Go application with GORM using the PostgreSQL driver, I encountered the following error:# gorm...

Gorm Many2Many on existing db entities empty

Many2Many on existing db entities emptyThe database and the table exist. Migrations and management remain in the third-p...

Gorm 测试default时的错误

当我测试gorm文档中的default标记时,创建数据表报错:type User struct { ID string gorm:"default:uuid_generate_v3()" // db func Fi...

Gorm FirstOrCreate 后调用 Save 提示 Duplicate entry '2' for key 'help_relation.PRIMARY'

var info models.HelpRelation // 关系 err = p.DB().Debug().Model(&info). Where(models....

Gorm MySQL-描述表的结构体,给其属性添加autoIncrement 执行AutoMigrate()方法 数据库会新建一个索引

我的结构体节选type Site1 struct { ID string gorm:"size:25" SerialNo uint32 gorm:"column:serialN...

Gorm the output of .Debug() for UUID binary(16)

Your QuestionI use MySql binary(16) to store UUID generated from google uuid pkg. When under '.Debug()' mode, like db.De...

Gorm fatal error: concurrent map writes

Description极端情况下会触发map的并发写panic, 代码位置:https://github.com/go-gorm/gorm/blob/87decced23be0ce21929fe393fc4fa3a936b1ec8/sche...

Gorm About error is "invalid transaction", when delete transaction

Your QuestionDuring the first transaction, make a delete query twice and commit once.An error occurs when performing a q...

Gorm Count() erases SELECTs for Joins() statement if executed before a Find()

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/681DescriptionIf you add a Joins() preload statement to a...

Gorm 怎么能在查询前修改查询的字段

Describe the feature我有个需求,想在sql执行前,对字段进行 过滤、删减之类的操作。但是不知道怎么在查询前修改 查询的字段。 因为我的系统每个用户权限不一样,所以看到的字段不一样。 请问有没有相关示例代码可以参考?Mot...

Gorm [QUESTION] - Looking for some help for many to many in gorm v2

Your QuestionHi all, I'm finding it difficult to define many to many relationship using Gorm in following casesfeatures(...

Gorm Save Error! UNIQUE constraint failed: user_infos.id

GORM Playground Linkhere is my model i update userinfo at here and i alreay have a row in my databasehowever : gorm us...

Gorm Problem with COPY FROM STDIN functionality after upgrading GORM from v1.9.16 to v1.25.6

Your QuestionHello, everyone!In our project, we are using the COPY FROM STDIN statement to perform bulk imports in a Pos...

Gorm "On duplicate key update" in recursive query using gorm updates only parent_id field for the child record

The below is golang struct for the table where settings will be stored recursively.// Settings table in databasetype Set...

Gorm Weird behaviour with after query callback

Your QuestionI want to track every query to the database (MySQL).This is the init:func InitDatabase() error { err = D...

Gorm Support Sqlite Indexed By

Describe the featureSupport the Sqlite INDEXED BY clause when using the UseIndex hint.https://www.sqlite.org/lang_indexe...

Gorm Save失效

你可以看到我执行了一次更新操作BelongsTo=7但是接下来发生了我始料未及的问题,更新没有成功以下是我打印的sql,belongs_to=3值被还原了UPDATE `coupon` SET `created_at`='2024-01-0...
上一页 下一页
.