1
0
mirror of https://github.com/astaxie/beego.git synced 2024-07-03 13:34:13 +00:00
Beego/param/options.go

26 lines
432 B
Go
Raw Normal View History

2017-04-21 12:26:41 +00:00
package param
2017-04-22 22:33:50 +00:00
import (
"fmt"
)
var IsRequired MethodParamOption = func(p *MethodParam) {
p.required = true
}
2017-04-21 12:26:41 +00:00
var InHeader MethodParamOption = func(p *MethodParam) {
p.location = header
}
2017-04-22 22:33:50 +00:00
var InBody MethodParamOption = func(p *MethodParam) {
p.location = body
2017-04-21 12:26:41 +00:00
}
func Default(defValue interface{}) MethodParamOption {
return func(p *MethodParam) {
2017-04-22 22:33:50 +00:00
if defValue != nil {
p.defValue = fmt.Sprintf("%v", defValue)
}
2017-04-21 12:26:41 +00:00
}
}