Your Question
在 gorm 中,type User struct {
UserId int64 gorm:"autoIncrement"
Name string gorm:"primaryKey"
Password string gorm:"primaryKey"
signature string
CreatedAt time.Time gorm:"default (autoCreateTime)"
// DeleteAt time.Time
}
为什么但是在实际的数据库中,CREATE TABLE users (
user_id bigint DEFAULT NULL,
name varchar (255) DEFAULT NULL,
password varchar (255) DEFAULT NULL,
created_at datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
The document you expected this should be explained
Expected answer
Comment From: saeidee
What do you mean by field label? could you please link a playground PR?
Comment From: cjw0202
same here, add "autoCreateTime" to createTime, but it doesn't work