File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1106,6 +1106,11 @@ func isEq(fl FieldLevel) bool {
11061106 p := asFloat (param )
11071107
11081108 return field .Float () == p
1109+
1110+ case reflect .Bool :
1111+ p := asBool (param )
1112+
1113+ return field .Bool () == p
11091114 }
11101115
11111116 panic (fmt .Sprintf ("Bad field type %T" , field .Interface ()))
Original file line number Diff line number Diff line change @@ -249,6 +249,16 @@ func asFloat(param string) float64 {
249249 return i
250250}
251251
252+ // asBool returns the parameter as a bool
253+ // or panics if it can't convert
254+ func asBool (param string ) bool {
255+
256+ i , err := strconv .ParseBool (param )
257+ panicIf (err )
258+
259+ return i
260+ }
261+
252262func panicIf (err error ) {
253263 if err != nil {
254264 panic (err .Error ())
You can’t perform that action at this time.
0 commit comments