摘要:
** 1.Type(expression): ** int(time.Now().Weekday()) //星期转int int(time.Now().Month()) //月份转int var a float64 a = 3.1 b := int(a) //float64转int var a in 阅读全文
摘要:
下载cron包: go get github.com/robfig/cron 开启一个定时: 根据cron表达式进行时间调度,cron可以精确到秒,大部分表达式格式也是从秒开始。 c := cron.New()默认从分开始,所以加上cron.WithSeconds(),保证定时按照表达式字面意思执行 阅读全文
摘要:
Gorm连接MySQL: import ( _ "github.com/go-sql-driver/mysql" "github.com/jinzhu/gorm" ) type User struct { Id int `json:"id"` Name string `json:"name"` Ag 阅读全文