biu: github.com/tuotoo/biu/opt Index | Files

package opt

import "github.com/tuotoo/biu/opt"

Index

Package Files

route.go run.go services.go

Constants

const (
    APITagName   = "name"
    APITagDesc   = "desc"
    APITagFormat = "format"
)

type FieldType Uses

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

func (FieldType) String Uses

func (f FieldType) String() string

type ParamOpt Uses

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

type Route Uses

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 Uses

type RouteFunc func(*Route)

RouteFunc is the type of route options functions.

func DisableAuthPathDoc Uses

func DisableAuthPathDoc() RouteFunc

DisableAuthPathDoc disables auto generate path param docs for route.

func EnableAuth Uses

func EnableAuth() RouteFunc

EnableAuth enables JWT auth for a route.

func ExtraPathDocs Uses

func ExtraPathDocs(docs ...string) RouteFunc

ExtraPathDocs sets extra descriptions for path params.

func RouteAPI Uses

func RouteAPI(f interface{}) RouteFunc

func RouteErrors Uses

func RouteErrors(m map[int]string) RouteFunc

RouteErrors defines the errors of a route.

func RouteID Uses

func RouteID(id string) RouteFunc

RouteID sets the ID of a route.

func RouteTo Uses

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

RouteTo binds a function to a route.

type Run Uses

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

Run is the running options of container.

type RunFunc Uses

type RunFunc func(*Run)

RunFunc is the type of running config functions.

func AfterShutDown Uses

func AfterShutDown(f func()) RunFunc

AfterShutDown will run after http server shuts down.

func BeforeShutDown Uses

func BeforeShutDown(f func()) RunFunc

BeforeShutDown will run before http server shuts down.

func WithContext Uses

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

type Services Uses

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

Services is the options for biu.AddServices.

type ServicesFunc Uses

type ServicesFunc func(*Services)

ServicesFunc is the type of biu.AddServices options.

func Filters Uses

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

Filters sets a list of filters for all services.

func ServiceErrors Uses

func ServiceErrors(errors map[int]string) ServicesFunc

ServiceErrors declares the global errors for services.

type ServicesFuncArr Uses

type ServicesFuncArr []ServicesFunc

ServicesFuncArr is a slice of Services Functions.

Package opt imports 11 packages (graph) and is imported by 3 packages. Updated 2020-01-31. Refresh now. Tools for package owners.