1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-16 19:40:55 +00:00
Beego/param/options.go
2017-04-23 01:33:50 +03:00

26 lines
432 B
Go

package param
import (
"fmt"
)
var IsRequired MethodParamOption = func(p *MethodParam) {
p.required = true
}
var InHeader MethodParamOption = func(p *MethodParam) {
p.location = header
}
var InBody MethodParamOption = func(p *MethodParam) {
p.location = body
}
func Default(defValue interface{}) MethodParamOption {
return func(p *MethodParam) {
if defValue != nil {
p.defValue = fmt.Sprintf("%v", defValue)
}
}
}