1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-04 15:50:18 +00:00

move under context

This commit is contained in:
eyalpost
2017-04-25 18:39:42 +03:00
parent 9b79437778
commit cbd831042a
9 changed files with 5 additions and 5 deletions

31
context/param/options.go Normal file
View File

@ -0,0 +1,31 @@
package param
import (
"fmt"
)
type MethodParamOption func(*MethodParam)
var IsRequired MethodParamOption = func(p *MethodParam) {
p.required = true
}
var InHeader MethodParamOption = func(p *MethodParam) {
p.location = header
}
var InPath MethodParamOption = func(p *MethodParam) {
p.location = path
}
var InBody MethodParamOption = func(p *MethodParam) {
p.location = body
}
func Default(defValue interface{}) MethodParamOption {
return func(p *MethodParam) {
if defValue != nil {
p.defValue = fmt.Sprint(defValue)
}
}
}