Documentation
¶
Index ¶
- Constants
- Variables
- func AuthCros() gin.HandlerFunc
- func Bind(c *gin.Context, req interface{}) error
- func GenToken(name string) (string, error)
- func HTTPResponse(c *Context, httpCode *int, err *error, data *interface{})
- type Context
- type ListData
- type Operator
- type PageOption
- type ResultReply
- type TotalOption
Constants ¶
View Source
const TokenExpireDuration = time.Hour * 24 * 30
TokenExpireDuration expireDuration
Variables ¶
View Source
var MySecret = []byte("#1024helper")
MySecret ...
Functions ¶
func HTTPResponse ¶
HTTPResponse 统一返回格式
Types ¶
type Context ¶
type Context struct {
context.Context
Operator *Operator
// contains filtered or unexported fields
}
Context context define
type ListData ¶
type ListData struct {
TotalOption
List interface{} `json:"list"`
}
ListData ...
func NewListData ¶
func NewListData(opt PageOption, total int64, list interface{}) *ListData
NewListData fill data
type PageOption ¶
type PageOption struct {
PageIndex int `form:"pageIndex"`
PageSize int `form:"pageSize"`
Sort string `form:"sort"` //asc or desc
Scope string `form:"scope"`
}
PageOption ...
type ResultReply ¶
type ResultReply struct {
Result bool `json:"result"`
Msg interface{} `json:"msg"`
}
ResultReply ...
Click to show internal directories.
Click to hide internal directories.