Documentation ¶
Index ¶
- Variables
- func AddNoCheckLoginRequestId(ids ...int)
- func AddOnlyLoginRequestId(ids ...int)
- func AllDispatcher() map[string]Dispatch
- func AllDispatcherLength() int
- func RegisterDefaultDispatcherHandleMethod(methods map[string]DefaultDispatcherHandleMethod)
- func RegisterDispatch(dispatcher Dispatch)
- func RegisterLogCallback(callback func(content LogContent))
- func RegisterPassword(password Password)
- func SetDb(d *sql.DB)
- type Context
- type DefaultDispatcherHandleMethod
- type Dispatch
- type LogContent
- type Password
- type PasswordDefault
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ActionName = "_action"
请求标识变量名
View Source
var Db *sql.DB
View Source
var DefaultDispatcher = &defaultDispatcher{HandleMethod: make(map[string]DefaultDispatcherHandleMethod)}
View Source
var LogCallback func(content LogContent)
View Source
var NoCheckLoginRequestIds = []int{1}
无需登录的请求ID
View Source
var OnlyLoginRequestIds = []int{2, 3, 4}
无需检查权限/只需要登录的请求ID
View Source
var TokenName = "_token"
请求token变量名
Functions ¶
func AllDispatcher ¶
func AllDispatcherLength ¶
func AllDispatcherLength() int
func RegisterDefaultDispatcherHandleMethod ¶
func RegisterDefaultDispatcherHandleMethod(methods map[string]DefaultDispatcherHandleMethod)
注册默认调度器请求处理方法
func RegisterDispatch ¶
func RegisterDispatch(dispatcher Dispatch)
Types ¶
type Context ¶
type Context struct { Action string Token string HttpResponseWriter http.ResponseWriter HttpRequest *http.Request Request *request.Model User *user.Model Response *Response }
func (*Context) SetResponse ¶
type Dispatch ¶
type Dispatch interface { // 调度器标识 Key() string // 调度器名称 Name() string // 调度器描述 Description() string // 请求调度方法 Call(*Context) (interface{}, error) }
调度器接口
func GetDispatcher ¶
type LogContent ¶
type PasswordDefault ¶
type PasswordDefault struct { }
默认密码生成器
func (*PasswordDefault) Hash ¶
func (p *PasswordDefault) Hash(password []byte) []byte
func (*PasswordDefault) Verify ¶
func (p *PasswordDefault) Verify(password, hash []byte) bool
Click to show internal directories.
Click to hide internal directories.