1 Star 1 Fork 1

xiaoyutab / xgotool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
create_role.go 480 Bytes
一键复制 编辑 原始数据 按行查看 历史
package xauth
import (
"time"
)
// 创建角色信息
//
// c 待创建的角色信息
func CreateRole(c *Role) error {
if _default.DB == nil {
return errFun("数据库未连接", nil)
}
if c.Title == "" {
return errFun("角色标题不能为空", nil)
}
c.UpdatedAt = time.Now().Format(time.DateTime)
if c.CreatedAt == "" {
c.CreatedAt = c.UpdatedAt
}
err := _default.DB.Save(c).Error
if err != nil {
return errFun("角色创建失败", err)
}
return nil
}
Go
1
https://gitee.com/xiaoyutab/xgotool.git
git@gitee.com:xiaoyutab/xgotool.git
xiaoyutab
xgotool
xgotool
v0.3.9

搜索帮助

53164aa7 5694891 3bd8fe86 5694891