artisan

package
v0.0.0-...-867eee7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var App *iris.Application

Functions

func ApiHandler

func ApiHandler(handler func(ctx iris.Context, param JsonMap) (result interface{}, err error)) func(ctx iris.Context)

func ApiRecover

func ApiRecover(ctx iris.Context)

func Md5bin

func Md5bin(bin []byte) string

func NewApp

func NewApp() *iris.Application

func Throttle

func Throttle(options ...ThrottleOption) func(ctx iris.Context)

频率限制器, 漏斗算法

Types

type AppError

type AppError interface {
	error
	Code() int
	Parent() error
}

func ErrorFrom

func ErrorFrom(err error) AppError

type JsonMap

type JsonMap map[string]interface{}

func (JsonMap) Get

func (m JsonMap) Get(keys ...string) JsonValue

type JsonValue

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

func (JsonValue) Array

func (v JsonValue) Array() []JsonValue

func (JsonValue) Float

func (v JsonValue) Float() float64

func (JsonValue) Int

func (v JsonValue) Int() int

func (JsonValue) Int64

func (v JsonValue) Int64() int64

func (JsonValue) Map

func (v JsonValue) Map() JsonMap

func (JsonValue) String

func (v JsonValue) String(ignore ...interface{}) string

type NormalError

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

func NewError

func NewError(message string, code int, parent error) *NormalError

func (*NormalError) Code

func (e *NormalError) Code() int

func (*NormalError) Error

func (e *NormalError) Error() string

func (*NormalError) Parent

func (e *NormalError) Parent() error

type ThrottleOption

type ThrottleOption struct {
	Duration time.Duration // 时间窗口
	Number   int           // 允许操作次数
	GetKey   func(ctx iris.Context) string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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