app

package
v0.0.0-...-691314a Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ShortId = shortid.Shortid{}

Functions

func Base62Encode

func Base62Encode(i int64) string

Base62Encode Custom base62 encoding

func GenerateToken

func GenerateToken(appKey, appSecret string) (string, error)

func GetJWTSecret

func GetJWTSecret() []byte

func GetPage

func GetPage(c echo.Context) int

func GetPageOffset

func GetPageOffset(page, pageSize int) int

func GetPageSize

func GetPageSize(c echo.Context) int

func Now

func Now() time.Time

func ShortUUID

func ShortUUID() string

func Sid

func Sid() string

Types

type Claims

type Claims struct {
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

type CustomValidator

type CustomValidator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator() *CustomValidator

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

type Jwt

type Jwt struct {
	Secret string
	Expire time.Duration
	Issuer string
}

type Pager

type Pager struct {
	Page      int `json:"page"`
	PageSize  int `json:"page_size"`
	TotalRows int `json:"total_rows"`
}

type Response

type Response struct {
	Ctx echo.Context
}

func NewResponse

func NewResponse(ctx echo.Context) *Response

func (*Response) ToErrorResponse

func (r *Response) ToErrorResponse(err *errcode.Error) error

func (*Response) ToResponse

func (r *Response) ToResponse(data interface{}) error

func (*Response) ToResponseList

func (r *Response) ToResponseList(list interface{}, totalRows int) error

type ValidError

type ValidError struct {
	Key     string
	Message string
}

func (*ValidError) Error

func (v *ValidError) Error() string

type ValidErrors

type ValidErrors []*ValidError

func BindAndValid

func BindAndValid(e echo.Context, v interface{}) (bool, ValidErrors)

func (ValidErrors) Error

func (v ValidErrors) Error() string

func (ValidErrors) Errors

func (v ValidErrors) Errors() []string

Jump to

Keyboard shortcuts

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