Gorm TTL or soft delete in the future

Describe the featureI think it would be more logical to use NOW() check for deleted_at field instead of NULL only checkS...

Gorm 为啥无法创建多个字表

func (Animal) TableName() string { return "test_" + strconv.Itoa(index)}func main() {//连接数据库gorm.io/gormdb, err := go...

Gorm Preload seperate fields to the same model

Your QuestionIf this has already been answered i appologise, i couldn't find one in my search.I am looking for a way to ...

Gorm Using AutoMigrate in a transaction, an error occurs

Environmentplatform: macos go version: 1.16.6 gorm verison: v1.23.3DescriptionWhen I execute it the second time, t...

Gorm tables lost when joins exists in from clause

in file: callbacks/query.go97 joins := []clause.Join{}98 if fromClause, ok := db.Statement.Clauses["FROM&...

Gorm failed to parse default value CURRENT_TIMESTAMP for field

`type AgentInfo struct {Id int `gorm:"primary_key;AUTO_INCREMENT;column:id;type:int;" json:"id"`AgentStatusTime Time `go...

Gorm gorm最新版Has Many只写入了关联数组的第一个

测试程序如下:package mainimport ( "fmt" "gorm.io/driver/sqlite" "gorm.io/gorm" &quot...

Gorm NamingStrategy.formatName does not replace special chars when formattedName is >=64-byte long

GORM Playground Link=> OK, will do later this week, too late for todayDescriptionWhen an FK-generated-name is too lon...

Gorm With Postgres, fails to create records with belongs_to association

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/458DescriptionA query fails to create (in this example ar...

Gorm table primary key ID after create is 0

GORM Playground Linkhttps://github.com/zcgzxg/gorm-issueDescriptionin above example,i got this:&{0 2022-02-23 17:02:...

Gorm table 字段标记了tag为主键, 无法插入试卷

表结构如下,DeviceID 是主键整数字段,但是不是自增类型type SensorCurrent struct { DeviceID uint json:"device_id" gorm:"p...

Gorm How to declare a model start with '_' in Gorm?

I'm trying to declare a model and insert some data in a table with a column named '_update_time'.type User struct{...Upd...

Gorm joins+scanf方法无法无法bind查询到的数据

gorm.io/driver/mysql v1.3.2gorm.io/gorm v1.23.2使用joins + scanf时 debug打印的sql可以查询到数据但我的指针对象为null`NewsJoinType struct { ...

Gorm gorm.io文档与实际效果有差异

Your Questiondb.Delete(&User{}, 10)官方文档:DELETE from user where id = 10;实际效果:DELETE from user where 10;First方法也有类似问题。...

Gorm Association ModifyStatement context nil

GORM Playground Linkhttps://github.com/go-gorm/playground/pull/457DescriptionAssociation modifyStatement should keep co...

Gorm setting default value for a field is not working

Your QuestionMy question is that why when I create a new object why default values aren't used in object creation?// Tod...

Gorm SQLite command PRAGMA table_ Is info ([table name]) not supported by Gorm?

SQLite command PRAGMA table_ Is info ([table name]) not supported by Gorm?The document you expected this should be expl...

Gorm Change Column name CreatedAt, UpdatedAt and DeletedAt

Hello, I'm trying to change the name of the default columns createdAt, updatedAt and deletedAt to another language, in t...

Gorm 如何使用Map条件进行模糊查询

使用Map条件进行查询时,进行的是精确匹配。例如代码db.Where(map[string]interface{}{"name": "jinzhu", "age": 20}).Find(&users)得到的SQL是SELECT * ...

Gorm Do we need call tx.Rollback() after tx.Commit() got error?

Your QuestionDo we need call tx.Rollback() after tx.Commit() got error? According to examples in https://gorm.io/docs/tr...
上一页 下一页
.