Nineya
Home
Blog
软著申请
Gorm gorm sharding
2025-01-14 08:07:51
704
使用gorm做分表,想让主键id使用snowflake自动生成,同时也想让主键id作为shardingkey,但是插入的时候不传入主键id就报错,只有主键id和shardingKey是不同字段才能自动生成snowflakes的主键idCom...
Gorm Observer model
2025-01-14 08:07:48
728
hi, I'm looking for a solution to listen for the events trigger model ( created, updated, deleted, creating, deleting). ...
Gorm Beginning transaction when statement not empty can cause issues
2025-01-14 08:07:45
1171
GORM Playground Linkhttps://github.com/go-gorm/playground/pull/477DescriptionWithin a Hook I would like to do some delet...
Gorm JOIN in update is not working.
2025-01-14 08:07:43
887
tx.Model(&models.User{ID: 1}).Joins("INNER JOIN emails ON user.id = emails.user_id").Update("email_creater", 3)outpu...
Gorm 使用"gorm.io/gen" 生成的结构体,在后来使用 "gorm.io/gorm" 还原数据库表结构时,表中的PrimaryKey缺少AutoIncrement
2025-01-14 08:07:41
2859
使用"gorm.io/gen" 生成的结构体,在后来使用 "gorm.io/gorm" 还原数据库表结构时,表中的PrimaryKey缺少AutoIncrement1、使用Mysql 建立如下数据库example, 建立如下表people:...
Gorm 关联删除对象不支持物理删除选项
2025-01-14 08:07:36
419
Describe the featuregorm 关联删除目前没有物理删除的选项,存在deleted_at字段的时候,生成的sql是updateMotivation删除user 并且删除user关联的account 目前写法:db.Debu...
Gorm How to use two fields to union unique ??
2025-01-14 08:07:33
963
Your QuestionHow to use two fields to union unique ??The document you expected this should be explainedEg:type Role stru...
Gorm how to auto reconnect once mysql restart
2025-01-14 08:07:31
716
Hi would you like to tell me how to auto reconnect once mysql restart你好,我的程序一直跑着,如果数据库出现了中断之类或者重起之类。有什么方案可以不需要重起我的app程序。...
Gorm Named Arguments w/ d.Raw(), SQL Injection Safe?
2025-01-14 08:07:28
2034
I have a query similar to the one below, slightly different than the example for Named Arguments in the GORM documentati...
Gorm 更加方便的条件拼接以及智能提示功能
2025-01-14 08:07:25
821
1.现在写条件很多都是字符串形式例如db.Where("id = ?", 11).Find(&aic)如果数据库发生变更,修改代码工作量会很大,做成例如db.Select(Aic.Id, Aic.Name).Where.eq(Aic...
Gorm 能否增加createorupdate操作
2025-01-14 08:07:23
822
Comment From: smoothdvdAssign(params).FirstOrCreate(&model)Comment From: feifanshijieAssign(params).FirstOrCreate(&a...
Gorm POSTGRESQL:Has Many关联时候,在重写ID生成函数的时候,再有多个子项的时候ID只生成一个
2025-01-14 08:07:20
1698
type CommonModel struct { // ID UUID as database index ID string `gorm:"primary_key"` CreatedA...
Gorm Querying database tables and columns is wrong
2025-01-14 08:07:17
2903
GORM Playground Linkhttps://github.com/go-gorm/playground/pull/1DescriptionI have two tablestype PayLog struct { ID ...
Gorm 分页查询中使用count无法分页
2025-01-14 08:07:15
1174
err := db.DB.Limit(page.PageSize).Offset(offset).Where(whereQuery, whereParams...).Find(values).Error可以正常查询数据err := db.D...
Gorm 怎么在手动事务中使用嵌套事务?
2025-01-14 08:07:12
298
Your Question怎么在手动事务中使用嵌套事务?我尝试这样使用,但是会报错 no valid transaction // db is *gorm.DB parenTx := db.Begin() err = pa...
Gorm Global hook to prevent duplicated code
2025-01-14 08:07:10
1125
Your QuestionIs it possible to create a global hook to prevent duplicated code? Example:type StructA { ID uint `json:...
Gorm "RETURNING table.field" (without quoting table name) breaks Postgres in some cases.
2025-01-14 08:07:07
4389
See https://github.com/jinzhu/gorm/commit/21f4de584f1cd93b15bf2ed498e861933ff37ff4This is wrong and Postgres 9.3 will re...
Gorm add a function to get DB.Statement.Context easily
2025-01-14 08:07:05
978
Describe the featureAdd a method to get context from DB object easily, like this:func (db *DB) Context() context.Context...
Gorm Is it possible to write shared db operations once, and reuse?
2025-01-14 08:07:02
1023
I have created a dao level to wrap the database operations, each table has its own dao type.Now, each dao need to write ...
Gorm Repeat AutoMigrate on MariaDB cause String field default NULL value
2025-01-14 08:06:58
384
GORM Playground Linkhttps://github.com/go-gorm/playground/pull/453DescriptionAutoMigrate do every time causing by string...
上一页
下一页
1
…
989
990
991
992
993
…
2246
.