Gorm First等查询方法,如何避免日志中出现大量record not found?

自从用了新版本发现日志里出现大量record not found,作为error打印出来了,但我认为这并不是error,而且statement里提供了一个 RaiseErrorOnNotFound 选项,但是这个选项在First()等查询方...

Gorm MySQL / Error 1869: Auto-increment value in UPDATE conflicts with internally generated values

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/212DescriptionHello,When creating a record with Create(),...

Gorm GORM type 为int,在tag中指定了type为int类型,自动迁移后还是会创建为bigint的类型的字段。

GORM Playground LinkDescriptiontype User struct { Id int `gorm:"type:int"`}Comment From: github-actions[bot...

Gorm Why does db.RowsAffected return 0 after the data is updated?

After successfully updating data using Updates, RowsAffected returns 0db := mysql.DB.Model(&User{}).Where("dele...

Gorm Unexpected SQL Query Generation with Consecutive First Calls

DescriptionI am encountering an issue where consecutive calls to the First method generate a SQL query with duplicated c...

Gorm How to map a []int type to a string type in SQL?

Your QuestionI wrote the following code referring to this document:func connection() *gorm.DB { dsn := "root:roo...

Gorm 批量创建时,当传递的dst的元素是Interface时报错

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1问题描述定义如下接口type CommonSyncInstance interface {}定义如下model,...

Gorm Gorm v1.25.5 create two records,but get the duplicate PRIMARY KEY

DescriptionWe have a table like this:Table `MyTest` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 ID', `g...

Gorm Panic In AfterInitialize

https://github.com/go-gorm/gorm/blob/52404cddbb5f5b18253cebe12fde20b577b1c86d/gorm.go#L136When an error occurs in Apply ...

Gorm 外键bug

我有2张表,type QuantUser struct { gorm.Model UUID uuid.UUID `json:"uuid" gorm:"type:char(36);comment...

Gorm Many2Many Relation Produces Unwanted where Condition

Your QuestionWhy many2many relations produces an unwanted where condition?Reproduction StepsI have a gorm model which us...

Gorm Why not use the base entity to get the table name

Discussed in https://github.com/go-gorm/gorm/discussions/6866Originally posted by **cxy1620541673** March 5, 2024locati...

Gorm Partial failures in testing MySQL 5.7, all successful test cases in testing MySQL 8.0

The built-in test in the master branch passed all the test cases I ran using MySQL 8.0, while MySQL 5.7 partially failed...

Gorm GORM Save model with Associations but incorrect work

go gormhere is modelWhen I run the program twiceresult here in my database table:name in workers have a unique indexAs y...

Gorm Can Gorm elegantly update null value columns?

For example, using Must to specify the columns that must be updated:db.Where("id=?", id).Must("keywords&...

Gorm Default value for text type is not showing in generated structs

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1DescriptionI have created a user table for example:CREAT...

Gorm how do hook before select query on target tables

Your Questiontable user ( id, name )table staff ( id, user_id, name)table foo ( id, user_id, staff_id )table operations ...

Gorm unsupported data error with nested joins/preloads

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/715DescriptionIn our project we have deeply nested data t...

Gorm Noticed a bug with embedded structs not being nil

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/714DescriptionWhen adding a new type Address string and u...

Gorm Conditions for Joins

Hi! How can I write conditions for Joins? I need something like thisJoins("UserProgram", "currency_id = ? AND activated ...
上一页 下一页
.