opt

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APITagName   = "name"
	APITagDesc   = "desc"
	APITagFormat = "format"
	APITagIgnore = "-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldType added in v0.5.0

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

func (FieldType) String added in v0.5.0

func (f FieldType) String() string

type ParamOpt added in v0.5.0

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

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 added in v0.5.0

func RouteAPI(f any) 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()
	AfterStart     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 AfterStart added in v0.5.9

func AfterStart(f func()) RunFunc

func BeforeShutDown

func BeforeShutDown(f func()) RunFunc

BeforeShutDown will run before http server shuts down.

func WithContext added in v0.4.4

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.

Jump to

Keyboard shortcuts

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