services

package
v0.0.0-...-a4d5418 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

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 InitCache

func InitCache() (err error)

初始化缓存服务

func InitLog

func InitLog() error

初始化日志

func InitMysql

func InitMysql() error

初始化mysql

func InitVar

func InitVar() error

系统的所有全局变量初始化的地方

func IsDev

func IsDev() bool

开发模式

func IsProd

func IsProd() bool

线上环境

func NewJwtService

func NewJwtService() *jwtService

func NewPerm

func NewPerm() *permService

构造函数

func Orm

func Orm() orm.Ormer

beego orm

func RememberCache

func RememberCache(key string, value interface{}, timeout int, closure CacheClosure) error

获取和存储缓存 timeout 单位秒

func Repeat

func Repeat(obj interface{}, table string, pk string, fields ...string) (error, bool)

数据重复

func TableName

func TableName(name string) string

TableName 下面是统一的表名管理

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) GetUser

func (this *AuthService) GetUser() entitys.User

获取当前登录的用户对象

func (*AuthService) IsLogined

func (this *AuthService) IsLogined() bool

检查是否登录

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) SetUser

func (this *AuthService) SetUser(userId uint32) (err error)

手动设置登录用户

func (*AuthService) SetUserByToken

func (this *AuthService) SetUserByToken(token string) (err error)

通过token设置登录用户

type CacheClosure

type CacheClosure = func() interface{}

type TransactionClosure

type TransactionClosure = func(o orm.Ormer) error

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

事务闭包

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL