param

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertParams

func ConvertParams(methodParams []*MethodParam, methodType reflect.Type, ctx *beecontext.Context) (result []reflect.Value)

ConvertParams converts http method params to values that will be passed to the method controller as arguments

Types

type MethodParam

type MethodParam param.MethodParam

MethodParam keeps param information to be auto passed to controller methods

func Make

func Make(list ...*MethodParam) []*MethodParam

Make creates an array of MethodParmas or an empty array

func New

func New(name string, opts ...MethodParamOption) *MethodParam

New creates a new MethodParam with name and specific options

func (*MethodParam) String

func (mp *MethodParam) String() string

type MethodParamOption

type MethodParamOption func(*MethodParam)

MethodParamOption defines a func which apply options on a MethodParam

var InBody MethodParamOption = func(p *MethodParam) {
	param.InBody((*param.MethodParam)(p))
}

InBody indicates that this param is passed as an http request body

var InHeader MethodParamOption = func(p *MethodParam) {
	param.InHeader((*param.MethodParam)(p))
}

InHeader indicates that this param is passed via an http header

var InPath MethodParamOption = func(p *MethodParam) {
	param.InPath((*param.MethodParam)(p))
}

InPath indicates that this param is part of the URL path

var IsRequired MethodParamOption = func(p *MethodParam) {
	param.IsRequired((*param.MethodParam)(p))
}

IsRequired indicates that this param is required and can not be omitted from the http request

func Default

func Default(defaultValue interface{}) MethodParamOption

Default provides a default value for the http param

Jump to

Keyboard shortcuts

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