Documentation ¶
Index ¶
- Variables
- func InitCache() (err error)
- func InitLog() error
- func InitMysql() error
- func InitVar() error
- func IsDev() bool
- func IsProd() bool
- func NewJwtService() *jwtService
- func NewPerm() *permService
- func Orm() orm.Ormer
- func RememberCache(key string, value interface{}, timeout int, closure CacheClosure) error
- func Repeat(obj interface{}, table string, pk string, fields ...string) (error, bool)
- func TableName(name string) string
- type AuthService
- func (this *AuthService) CreateToken() (string, error)
- func (this *AuthService) GetUser() entitys.User
- func (this *AuthService) IsLogined() bool
- func (this *AuthService) IsNoAuthPerm(module, action string) bool
- func (this *AuthService) Login(login entitys.Login) (token string, err error)
- func (this *AuthService) SetUser(userId uint32) (err error)
- func (this *AuthService) SetUserByToken(token string) (err error)
- type CacheClosure
- type TransactionClosure
- type Transactor
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CacheService cache.Cache
)
View Source
var PermService *permService
权限服务单例对象
View Source
var RoleService *roleService
角色服务单例对象
View Source
var UserService *userService
用户服务单例对象
Functions ¶
func NewJwtService ¶
func NewJwtService() *jwtService
func RememberCache ¶
func RememberCache(key string, value interface{}, timeout int, closure CacheClosure) error
获取和存储缓存 timeout 单位秒
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
登录验证服务
func NewAuth ¶
func NewAuth() *AuthService
func (*AuthService) CreateToken ¶
func (this *AuthService) CreateToken() (string, error)
获取token认证密码
func (*AuthService) IsNoAuthPerm ¶
func (this *AuthService) IsNoAuthPerm(module, action string) bool
是否为不登录能访问的权限
func (*AuthService) Login ¶
func (this *AuthService) Login(login entitys.Login) (token string, err error)
用户登录
func (*AuthService) SetUserByToken ¶
func (this *AuthService) SetUserByToken(token string) (err error)
通过token设置登录用户
type CacheClosure ¶
type CacheClosure = func() interface{}
type TransactionClosure ¶
type Transactor ¶
type Transactor struct { Num uint32 //事务计数器 // contains filtered or unexported fields }
事务代理
func NewTransactor ¶
func NewTransactor() *Transactor
func (*Transactor) Transaction ¶
func (this *Transactor) Transaction(f TransactionClosure) error
事务闭包
Click to show internal directories.
Click to hide internal directories.