Versions in this module Expand all Collapse all v0 v0.1.1 Feb 25, 2020 v0.1.0 Feb 25, 2020 Changes in this version + func CheckIsRootUser(ctx context.Context, userID string) bool + func ExecTrans(ctx context.Context, transModel model.ITrans, fn TransFunc) error + func ExecTransWithLock(ctx context.Context, transModel model.ITrans, fn TransFunc) error + func GetRootUser() *schema.User + type Demo struct + DemoModel model.IDemo + func NewDemo(mDemo model.IDemo) *Demo + func (a *Demo) Create(ctx context.Context, item schema.Demo) (*schema.Demo, error) + func (a *Demo) Delete(ctx context.Context, recordID string) error + func (a *Demo) Get(ctx context.Context, recordID string, opts ...schema.DemoQueryOptions) (*schema.Demo, error) + func (a *Demo) Query(ctx context.Context, params schema.DemoQueryParam, ...) (*schema.DemoQueryResult, error) + func (a *Demo) Update(ctx context.Context, recordID string, item schema.Demo) (*schema.Demo, error) + func (a *Demo) UpdateStatus(ctx context.Context, recordID string, status int) error + type Login struct + Auth auth.Auther + MenuModel model.IMenu + RoleModel model.IRole + UserModel model.IUser + func NewLogin(a auth.Auther, mUser model.IUser, mRole model.IRole, mMenu model.IMenu) *Login + func (a *Login) DestroyToken(ctx context.Context, tokenString string) error + func (a *Login) GenerateToken(ctx context.Context, userID string) (*schema.LoginTokenInfo, error) + func (a *Login) GetCaptcha(ctx context.Context, length int) (*schema.LoginCaptcha, error) + func (a *Login) GetLoginInfo(ctx context.Context, userID string) (*schema.UserLoginInfo, error) + func (a *Login) QueryUserMenuTree(ctx context.Context, userID string) ([]*schema.MenuTree, error) + func (a *Login) ResCaptcha(ctx context.Context, w http.ResponseWriter, captchaID string, ...) error + func (a *Login) UpdatePassword(ctx context.Context, userID string, params schema.UpdatePasswordParam) error + func (a *Login) Verify(ctx context.Context, userName, password string) (*schema.User, error) + type Menu struct + MenuModel model.IMenu + TransModel model.ITrans + func NewMenu(trans model.ITrans, mMenu model.IMenu) *Menu + func (a *Menu) Create(ctx context.Context, item schema.Menu) (*schema.Menu, error) + func (a *Menu) Delete(ctx context.Context, recordID string) error + func (a *Menu) Get(ctx context.Context, recordID string, opts ...schema.MenuQueryOptions) (*schema.Menu, error) + func (a *Menu) Query(ctx context.Context, params schema.MenuQueryParam, ...) (*schema.MenuQueryResult, error) + func (a *Menu) Update(ctx context.Context, recordID string, item schema.Menu) (*schema.Menu, error) + type Role struct + DeleteHook func(context.Context, *Role, string) error + Enforcer *casbin.SyncedEnforcer + MenuModel model.IMenu + RoleModel model.IRole + SaveHook func(context.Context, *Role, *schema.Role) error + UserModel model.IUser + func NewRole(e *casbin.SyncedEnforcer, mRole model.IRole, mMenu model.IMenu, ...) *Role + func (a *Role) Create(ctx context.Context, item schema.Role) (*schema.Role, error) + func (a *Role) Delete(ctx context.Context, recordID string) error + func (a *Role) Get(ctx context.Context, recordID string, opts ...schema.RoleQueryOptions) (*schema.Role, error) + func (a *Role) GetMenuResources(ctx context.Context, item *schema.Role) (schema.MenuResources, error) + func (a *Role) LoadPolicy(ctx context.Context, item *schema.Role) error + func (a *Role) Query(ctx context.Context, params schema.RoleQueryParam, ...) (*schema.RoleQueryResult, error) + func (a *Role) Update(ctx context.Context, recordID string, item schema.Role) (*schema.Role, error) + type Trans struct + TransModel model.ITrans + func NewTrans(trans model.ITrans) *Trans + func (a *Trans) Exec(ctx context.Context, fn func(context.Context) error) error + type TransFunc func(context.Context) error + type User struct + DeleteHook func(context.Context, *User, string) error + Enforcer *casbin.SyncedEnforcer + RoleModel model.IRole + SaveHook func(context.Context, *User, *schema.User) error + UserModel model.IUser + func NewUser(e *casbin.SyncedEnforcer, mUser model.IUser, mRole model.IRole) *User + func (a *User) Create(ctx context.Context, item schema.User) (*schema.User, error) + func (a *User) Delete(ctx context.Context, recordID string) error + func (a *User) Get(ctx context.Context, recordID string, opts ...schema.UserQueryOptions) (*schema.User, error) + func (a *User) LoadPolicy(ctx context.Context, item *schema.User) error + func (a *User) Query(ctx context.Context, params schema.UserQueryParam, ...) (*schema.UserQueryResult, error) + func (a *User) QueryShow(ctx context.Context, params schema.UserQueryParam, ...) (*schema.UserShowQueryResult, error) + func (a *User) Update(ctx context.Context, recordID string, item schema.User) (*schema.User, error) + func (a *User) UpdateStatus(ctx context.Context, recordID string, status int) error