博客系统,gin、casbin、jwt、restful api。
启动
go run main.go
生成api文档
swag init
访问 http://localhost:8080/swagger/index.html
安装air
go get -v github.com/cosmtrek/air/cmd/...
创建.air.conf文件
可以复制 https://github.com/cosmtrek/air 里面的air.conf.example内容
根目录下
air
db.Save(&user)会一同更新created_at。为了使created_at字段的值不被重置,可以使用Omit忽略字段。即:db.Omit(“created_at”).Save(&user)