From 56cf9ba23c86624948a607297d52b859ab60e8e4 Mon Sep 17 00:00:00 2001 From: mountain Date: Wed, 1 Oct 2025 21:32:08 +0900 Subject: [PATCH] =?UTF-8?q?convertinterface=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index c6987c2..d7af70b 100644 --- a/server.go +++ b/server.go @@ -352,8 +352,13 @@ func ConvertInterface(from interface{}, toType reflect.Type) reflect.Value { return convslice case reflect.Bool: - val, _ := strconv.ParseBool(from.(string)) - return reflect.ValueOf(val) + if fromstr, ok := from.(string); ok { + val, _ := strconv.ParseBool(fromstr) + return reflect.ValueOf(val) + } else if frombool, ok := from.(bool); ok { + return reflect.ValueOf(frombool) + } + return reflect.ValueOf(false) case reflect.String: if toType == reflect.TypeOf(primitive.ObjectID{}) {