utils

package
v0.0.0-...-ac3974b Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSG_OK       = 0  // 成功
	MSG_ERR      = -1 // 错误
	MSG_REDIRECT = -2 // 重定向
	MSG_AUTH     = -3 // 登录认证
)
View Source
const (
	PageSize = 15
)

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(str string) string

Capitalize 字符首字母大写

Types

type JWToken

type JWToken struct {
	SignString string
}

JWToken jwt token

func NewJWToken

func NewJWToken(signString string) *JWToken

NewJWToken 创建JWToken对象

func (*JWToken) GenJWToken

func (t *JWToken) GenJWToken(rawContent map[string]interface{}) (string, error)

GenJWToken 生成一个jwt token

func (*JWToken) ParseJWToken

func (t *JWToken) ParseJWToken(tokenString string) (map[string]interface{}, error)

ParseJWToken 解析 JWToken

type Page

type Page struct {
	Current int `json:"current"`
	Size    int `json:"size"`
	Total   int `json:"total"`
}

Pagination represents pagination info.

func NewPage

func NewPage(currentPageNum, pageSize, recordCount int) *Page

NewPage creates a new pagination with the specified current page num, page size, window size and record count.

type Response

type Response struct {
	Code int         `json:"code"` // return code, 0 for succ
	Msg  string      `json:"msg"`  // message
	Data interface{} `json:"data"` // data object
}

Response represents HTTP response body.

func NewResponse

func NewResponse() *Response

NewResponse creates a result with Code=0, Msg="", Data=nil.

Jump to

Keyboard shortcuts

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