beego: github.com/astaxie/beego/context/param Index | Files

package param

import "github.com/astaxie/beego/context/param"

Index

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

func Make Uses

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

Make creates an array of MethodParmas or an empty array

type MethodParam Uses

type MethodParam struct {
    // contains filtered or unexported fields
}

MethodParam keeps param information to be auto passed to controller methods

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) {
    p.in = body
}

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

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

InHeader indicates that this param is passed via an http header

var InPath MethodParamOption = func(p *MethodParam) {
    p.in = 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 43 packages. Updated 2017-11-02. Refresh now. Tools for package owners.