From 5ad727fb3a3cfa0413865768cd0225eeaa25e93a Mon Sep 17 00:00:00 2001 From: what Date: Sun, 30 Jul 2023 16:44:50 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20boolean=20=E7=B1=BB=E5=9E=8B=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/res_field.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/res_field.go b/base/res_field.go index cf85ae6..aa3f198 100644 --- a/base/res_field.go +++ b/base/res_field.go @@ -140,8 +140,10 @@ func (this ResField) ToValue(v any) any { case contracts.ResDataType_Decimal: return strings.Trim(cast.ToString(v), " ") case contracts.ResDataType_Boolean: - v, _ := strconv.ParseBool(fmt.Sprintf("%v", v)) - return v + if v, _ := strconv.ParseBool(fmt.Sprintf("%v", v)); v { + return 1 + } + return 0 case contracts.ResDataType_Json: if v == nil { if this.Default != "" && this.Default[0:1] == "[" {