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

golint fixes

This commit is contained in:
Eyal Post
2017-04-30 19:28:26 +03:00
parent cfb2f68dd6
commit 1b8f05cef1
6 changed files with 27 additions and 13 deletions

View File

@ -4,24 +4,30 @@ 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 ommited 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.location = header
}
// InPath indicates that this param is part of the URL path
var InPath MethodParamOption = func(p *MethodParam) {
p.location = path
}
// InBody indicates that this param is passed as an http request body
var InBody MethodParamOption = func(p *MethodParam) {
p.location = body
}
// Default provides a default value for the http param
func Default(defValue interface{}) MethodParamOption {
return func(p *MethodParam) {
if defValue != nil {