Gorm Inconsistent default value check between MySQL and MariaDB

Consider the following schema:type User { ID string `gorm:"primary_key"` Name string `gorm:"unique&...

Gorm goroutines环境下,运行一段时间后,单表查询的结果不对

Your Question在多goroutines环境下单表查询,运行几个小时后,修改某个数据,查询能返回正确的值,继续再运行几个小时,再次查询,返回的数据跟表中数据不一致(中间没有再修改数据)In the multi goroutines...

Gorm 想问一下,当定义指针类型的struct变量,查不到数据,是否不用将变量初始化成 empty struct

想问一下,当定义指针类型的struct变量,查不到数据,是否不用将变量初始化成 empty struct。empty struct和查不到数据是两个概念。比如定义 var s *structFind在查不到数据的时候会返回empty str...

Gorm Is there a way to get the executed SQL statement directly?

Your QuestionFor example: models.db.save (& user) I want to get the executed SQL statement. Is there any way...

Gorm Nested transactions don't work with manual transaction begin/close functions

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/482DescriptionIt appears that nested transactions aren't ...

Gorm 表关联

我创建了一个模型类,希望可以希望可以和其他表关联起来。我的字段名创建的是Id,但是在通过这个字段查询的时候,是查不到了,会提示 *Error 1054: Unknown column 'user_permissions.UserId' in...

Gorm How to change the generated SQL for CREATE TABLE.

Your QuestionTrying to enhance the gorm-firebird driver from “github.com/flylink888/gorm-firebird”. Running the tests ag...

Gorm Frequency for new tag release

Your QuestionHow often we have a new tag release to get the latest changes ?Comment From: jinzhuQuite depends on how man...

Gorm many2many 关系表, 在Preload的时候,没有使用中间表的deleted_at

Your Question类似如下三张表type User struct{ gorm.Model Resources [] Resource gorm:"many2many:user_languages"}type Resource s...

Gorm undocumented breaking change in gorm v2, the value of the ignored field gorm:"-" in struct is not updated when use Update().

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/480DescriptionIn gorm V1 , the value of the ignored field...

Gorm Delete nested data with GORM.

Your QuestionI have a nested schema. The nested relationships are many-many relationships.How do I delete nested the dat...

Gorm key field

I have a field in my MySQL database called key.My code: ... .Where("key = ?", key) ...Unfortunately the generated sql do...

Gorm Using 'group' as column name breaks queries with Where

Go 1.13.7 - Postgres 12.2Just wanted to report, I had a structtype User struct { gorm.Model Group uint Name uint}and ...

Gorm gorm v1 and v2 is incompatible (db=db.Where())

Your Questionv1:v2: v2 result:{"level":"DEBUG","time":"2022-05-30 17:40:29","caller":"mysql/user.go:17","message":"Datab...

Gorm feat: custom log sql generation function

custom log sql generation functioncustom log sql generation functionchange Logger Interface Trace Methodnow :type Interf...

Gorm After update, the value of the ignored field gorm:"-" in struct is not updated

Your QuestionIn gorm V1 , the value of the ignored field gorm:"-" will changed after updatetype User struct { gorm.Mo...

Gorm How to automatically create tables with different table names in the same model

Your QuestionWhen I use the same model to create tables with different table names like in the example belowvar tableTpl...

Gorm AutoMigrate / PrepareStmt fails with sql: expected 0 arguments, got 1

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/479DescriptionSince v1.3.6 of gorm.io/driver/postgres Aut...

Gorm sql: Scan error on column index xxx, name "id": destination not a pointer

Your QuestionI have a couple of Models such asTag struct { gorm.Model Name string `gorm:"not null;uniqu...

Gorm How to make gorm respect the default value defined in table DDL?

Your QuestionAssuming we have the following table created in a PostgreSQL database:CREATE TABLE users( id BI...
上一页 下一页
.