From b93b1d8ec144f9f7252cbf3e220b612630f235b5 Mon Sep 17 00:00:00 2001 From: hupeh Date: Thu, 12 Oct 2023 16:11:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/is/is.go | 2 +- pkg/is/util.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/is/is.go b/pkg/is/is.go index 379dd93..61bd3af 100644 --- a/pkg/is/is.go +++ b/pkg/is/is.go @@ -286,7 +286,7 @@ func Longitude[T any](t T) bool { // JSON is the validation function for validating if the current field's value is a valid json string. func JSON[T any](t T) bool { rv := reflect.ValueOf(t) - if rv.Type() == bytesType { + if rv.Type() == nilType { return json.Valid(rv.Bytes()) } if rv.Kind() == reflect.String { diff --git a/pkg/is/util.go b/pkg/is/util.go index 3d180e8..421c93d 100644 --- a/pkg/is/util.go +++ b/pkg/is/util.go @@ -16,7 +16,7 @@ var ( ErrBadRange = errors.New("bad value range") timeType = reflect.TypeOf(time.Time{}) - //nilType = reflect.TypeOf([]byte(nil)) + nilType = reflect.TypeOf([]byte(nil)) ) // convert value to float64, return error on failed