/
githubmirror
/
beego
Обзор
Документация
Войти
/
githubmirror
/
beego
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
server/web/context/param/options.go
37 строк
964 B
Ming Deng
remove pkg directory;
08 окт 2020, 13:29
08 окт 2020, 13:29
14c1b76
Код
Авторство
О чём код?
package param import ( "fmt" ) // MethodParamOption defines a func which apply options on a MethodParam type MethodParamOption func(*MethodParam) // IsRequired indicates that this param is required and can not be omitted from the http request var IsRequired MethodParamOption = func(p *MethodParam) { p.required = true } // InHeader indicates that this param is passed via an http header var InHeader MethodParamOption = func(p *MethodParam) { p.in = header } // InPath indicates that this param is part of the URL path var InPath MethodParamOption = func(p *MethodParam) { p.in = path } // InBody indicates that this param is passed as an http request body var InBody MethodParamOption = func(p *MethodParam) { p.in = body } // Default provides a default value for the http param func Default(defaultValue interface{}) MethodParamOption { return func(p *MethodParam) { if defaultValue != nil { p.defaultValue = fmt.Sprint(defaultValue) } } }