Gorm 查询"timestamp"时间类型,时区丢失问题

大背景: java改go数据库时间类型"timestamp", 存储为当地时间(没有带时区, 且没有做时区偏移处理) : 数据如下实现: java接口不变, impl由go提供。java使用Date,go使用time.Time接收时间类型...

Gorm can not link clickhouse

clickhouse version == 20.12.4.5Comment From: zhuyujie000please help me.Sorry my English is not good enoughComment From: ...

Gorm 希望支持 optimisticlock 插件。

在使用gorm-gen时,出现panic生成语句:g.GenerateModel("user", optVersionType := gen.FieldType("version", "op...

Gorm cannot use []uint8{1,2} for where condition, only support []string{"1", "2"}

DescriptionI use gin + gorm + postgresqlI defined consts:const ( cpnTypeCheckbox uint8 = 20 CpnTypeCascader uint8 ...

Gorm Using a pointer for a foreign-key related field yields unexpected behavior when selecting multiple values

Your QuestionSuppose you have database models as follows:package storagetype Country struct { ID string `json:&quot...

Gorm Scan does not return RowsAffected when update

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1Descriptionversiongorm.io/driver/mysql v1.1.2 gorm.io...

Gorm Update的时候,如果指定了model,不能根据主键生成where条件

v1.23.5func Test_update_where(t *testing.T) { defer func() { if r := recover(); r != nil { fmt.Prin...

Gorm Please considering support 'using tag to generate forerign keys'

This is first time I use Gorm, it's really amazing and very easy to use.But it cost me lots of time to figure out how to...

Gorm How to inject dependencies into hooks?

Your QuestionA hook is a method on a model that receives a DB object (and a pointer to itself). This limits possible hoo...

Gorm [error] unsupported data type: &[]

gorm.io/gorm v1.23.62022/06/11 09:24:58 github.com/hktalent/goSqlite_gorm@v1.0.6/pkg/db/db.go:48[error] unsupported data...

Gorm model cannot create time type

type LotteryResultDate struct { Id int64 `gorm:"primary_key"` CreatedAt time.Time `gorm:...

Gorm Panic on AutoMigration

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1DescriptionAutoMigration panic when add new column.panic...

Gorm [mysql] Omit("SomeReference.*") does empty insert for references

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/435DescriptionGorm v1.22.5For objects with a "has one" or...

Gorm Upsert with has_many association

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/459DescriptionIn this sample, I have a model Article with...

Gorm why sql count use 'count(*)' not use 'count(1)'?

if my table is more than ten million data, it use more than ten seconds. if i use count(1), it will save half time.Comme...

Gorm AutoMigrate PostgreSQL deadlock (V1.23.5)

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/451DescriptionAutoMigrate(PostgreSQL,timestamptz(0)) Firs...

Gorm clause.OnConflict{UpdateAll: true} 不会更新 update_time

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/481Description`package mainimport ( "fmt" "time""go...

Gorm When I only need to query one field,I want user Scan() to receive result by an array of underlying variable types

Describe the feature当我使用gorm查询返回某一个字段结果时候,我希望用一个int数组或者string数组进行直接接收,而不是需要定义一个结构体数组获取返回结果Motivation查询统计数据的时候会很需要这样的功能,能...

Gorm sqlite AutoMigrate时报错converting argument $1 type: unsupported type clause.Expr, a struct

Description在v1.22.4报错:gorm.io/driver/sqlite@v1.1.4/migrator.go:108 sql: converting argument $1 type: unsupported type cl...

Gorm When using FindInBatches, is it necessary to judge tx.Error in the handler function

Your Question`// batch size 100result := db.Where("processed = ?", false).FindInBatches(&results, 100, func(tx *gorm...
上一页 下一页
.