v1.12.3 Latest Latest

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 8 Imported by: 232




This section is empty.


This section is empty.


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


type MethodParam

type MethodParam struct {
	// contains filtered or unexported fields

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) { = body

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

var InHeader MethodParamOption = func(p *MethodParam) { = header

InHeader indicates that this param is passed via an http header

var InPath MethodParamOption = func(p *MethodParam) { = path

InPath indicates that this param is part of the URL path

var IsRequired MethodParamOption = func(p *MethodParam) {
	p.required = true

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