Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldType

type FieldType int8
const (
	FieldUnknown FieldType = iota
	FieldHeader
	FieldPath
	FieldQuery
	FieldForm
	FieldBody
	FieldReturn
)

func (FieldType) String

func (f FieldType) String() string

type ParamOpt

type ParamOpt struct {
	Name      string
	Type      string
	Format    string
	Desc      string
	IsMulti   bool
	FieldType FieldType
	FieldName string
	Body      interface{}
	Return    interface{}
}

type Route

type Route struct {
	ID                string
	To                func(ctx box.Ctx)
	Auth              bool
	Errors            map[int]string
	EnableAutoPathDoc bool
	ExtraPathDocs     []string
	Params            []ParamOpt
}

Route is the options of route.

type RouteFunc

type RouteFunc func(*Route)

RouteFunc is the type of route options functions.

func DisableAuthPathDoc

func DisableAuthPathDoc() RouteFunc

DisableAuthPathDoc disables auto generate path param docs for route.

func EnableAuth

func EnableAuth() RouteFunc

EnableAuth enables JWT auth for a route.

func ExtraPathDocs

func ExtraPathDocs(docs ...string) RouteFunc

ExtraPathDocs sets extra descriptions for path params.

func RouteAPI

func RouteAPI(f interface{}) RouteFunc

func RouteErrors

func RouteErrors(m map[int]string) RouteFunc

RouteErrors defines the errors of a route.

func RouteID

func RouteID(id string) RouteFunc

RouteID sets the ID of a route.

func RouteTo

func RouteTo(f func(ctx box.Ctx)) RouteFunc

RouteTo binds a function to a route.

type Run

type Run struct {
	BeforeShutDown func()
	AfterShutDown  func()
	Ctx            context.Context
	Cancel         context.CancelFunc
}

Run is the running options of container.

type RunFunc

type RunFunc func(*Run)

RunFunc is the type of running config functions.

func AfterShutDown

func AfterShutDown(f func()) RunFunc

AfterShutDown will run after http server shuts down.

func BeforeShutDown

func BeforeShutDown(f func()) RunFunc

BeforeShutDown will run before http server shuts down.

func WithContext

func WithContext(ctx context.Context, cancel context.CancelFunc) RunFunc

type Services

type Services struct {
	Filters []restful.FilterFunction
	Errors  map[int]string
}

Services is the options for biu.AddServices.

type ServicesFunc

type ServicesFunc func(*Services)

ServicesFunc is the type of biu.AddServices options.

func Filters

func Filters(filters ...restful.FilterFunction) ServicesFunc

Filters sets a list of filters for all services.

func ServiceErrors

func ServiceErrors(errors map[int]string) ServicesFunc

ServiceErrors declares the global errors for services.

type ServicesFuncArr

type ServicesFuncArr []ServicesFunc

ServicesFuncArr is a slice of Services Functions.