![]() |
il y a 4 ans | |
---|---|---|
crud | il y a 4 ans | |
internal | il y a 4 ans | |
orm | il y a 4 ans | |
scenario | il y a 4 ans | |
vendor | il y a 4 ans | |
.gitignore | il y a 4 ans | |
README.md | il y a 4 ans | |
api.go | il y a 4 ans | |
go.mod | il y a 4 ans | |
go.sum | il y a 4 ans | |
rest.go | il y a 4 ans |
1.安装包
go get git.nspix.com/golang/rest
初始化rest组件
rest.Initialize(svr.httpSvr, svr.db)
# 如果需要注册校验组件,可以通过下面方式
validator.RegisterCallbacks(svr.db)
注册模型
if err = rest.RegisterModel("webhook", &model.Repository{}); err != nil {
log.Warnf("register repository model error: %s", err.Error())
}