beego: Index | Files

package param

import ""


Package Files

conv.go methodparams.go options.go parsers.go

func ConvertParams Uses

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 Uses

type MethodParam struct {
    // contains filtered or unexported fields

MethodParam keeps param information to be auto passed to controller methods

func Make Uses

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

Make creates an array of MethodParmas or an empty array

func New Uses

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

New creates a new MethodParam with name and specific options

func (*MethodParam) String Uses

func (mp *MethodParam) String() string

type MethodParamOption Uses

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 Uses

func Default(defaultValue interface{}) MethodParamOption

Default provides a default value for the http param

Package param imports 8 packages (graph) and is imported by 1 packages. Updated 2020-11-07. Refresh now. Tools for package owners.