gorm使用连接池
//db, err = gorm.Open(“mysql”, “root:password@tcp(… 继续阅读 gorm使用连接池
//db, err = gorm.Open(“mysql”, “root:password@tcp(… 继续阅读 gorm使用连接池
package util import ( “gorm.io/driver/sqlite” “gor… 继续阅读 gorm 使用内存中的SQLite
db.Create(&user) // 将 `CreatedAt` 设为当前时间 // 想要… 继续阅读 gorm自定义CreatedAt值
type Student struct { Age int64 `gorm:”column:his_… 继续阅读 gorm自定字段名
type Blog struct { ID int Author Author `gorm:”emb… 继续阅读 gorm字段使用自定义前缀
解决办法: root:123456@tcp(127.0.0.1:3306)/testdb?chars… 继续阅读 Scan error on column index 1, name “created_at”: unsupported Scan, storing driver.Value type []uint8
newUser := model.User{ Phone: phone, Password: str… 继续阅读 gorm insert捕获失败情况
update t1 set ArrivalDate=date_add(ArrivalDate, in… 继续阅读 mysql data_time增加天数
$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL… 继续阅读 kill信号列表
func main() { router := gin.Default() // 为 multipa… 继续阅读 gin router 限制multipart forms内存
//默认0表示不限制 db.DB().SetMaxIdleConns(2000) db.DB().S… 继续阅读 gorm设置最大连接数和最大闲置数
db.Set(“grom:table_options”, “ENGINE=InnoDB”)
// 如果设置为true,`User`的默认表名为`user`,使用`TableName`设置的表名… 继续阅读 gorm全局禁用表名复数
db.LogMode(true)
gorm.DefaultTableNameHanlder = func(db *gorm.DB,de… 继续阅读 gorm给默认表名加前缀和后缀
type User struct{ Id int Name string } // 自定义表名 fu… 继续阅读 gorm自定义表名
int转成string: string := strconv.Itoa(int) int64转成st… 继续阅读 golang strconv字符串和int互转
get: https://github.com/apache/maven-mvnd https://… 继续阅读 apache mvnd 打包工程
“token”: “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ… 继续阅读 jwt token结构
timeoutHour := 24 expirationTime := time.Now().Add… 继续阅读 golang time duration usage