summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-xorm/xorm/convert.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-xorm/xorm/convert.go')
-rw-r--r--vendor/github.com/go-xorm/xorm/convert.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/go-xorm/xorm/convert.go b/vendor/github.com/go-xorm/xorm/convert.go
index fbd24b5b38..0504bef155 100644
--- a/vendor/github.com/go-xorm/xorm/convert.go
+++ b/vendor/github.com/go-xorm/xorm/convert.go
@@ -334,3 +334,15 @@ func convertInt(v interface{}) (int64, error) {
}
return 0, fmt.Errorf("unsupported type: %v", v)
}
+
+func asBool(bs []byte) (bool, error) {
+ if len(bs) == 0 {
+ return false, nil
+ }
+ if bs[0] == 0x00 {
+ return false, nil
+ } else if bs[0] == 0x01 {
+ return true, nil
+ }
+ return strconv.ParseBool(string(bs))
+}