From e99eb36ea676d2f7bd7a03bcb2069df90895a8ed Mon Sep 17 00:00:00 2001 From: raizen666 Date: Thu, 8 Jul 2021 23:29:26 +0800 Subject: [PATCH 1/4] add go-json add go-json --- go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/go.mod b/go.mod index 78d8d7d4..dbc59e76 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/json-iterator/go v1.1.11 github.com/lib/pq v1.7.0 github.com/mattn/go-sqlite3 v1.14.6 + github.com/goccy/go-json v0.7.4 github.com/shopspring/decimal v1.2.0 github.com/stretchr/testify v1.4.0 github.com/syndtr/goleveldb v1.0.0 -- 2.40.1 From 05854c899b565f69ff3ec53a20c6dffdbdfc3753 Mon Sep 17 00:00:00 2001 From: raizen666 Date: Thu, 8 Jul 2021 23:39:57 +0800 Subject: [PATCH 2/4] add go-json add go-json --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index 85953202..da88d67a 100644 --- a/go.sum +++ b/go.sum @@ -32,6 +32,8 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/goccy/go-json v0.7.4 h1:B44qRUFwz/vxPKPISQ1KhvzRi9kZ28RAf6YtjriBZ5k= +github.com/goccy/go-json v0.7.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -- 2.40.1 From 7961c74cf60b12f21904aafff93e35cdd32c561c Mon Sep 17 00:00:00 2001 From: raizen666 Date: Thu, 8 Jul 2021 23:43:43 +0800 Subject: [PATCH 3/4] add go-json --- internal/json/gojson.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 internal/json/gojson.go diff --git a/internal/json/gojson.go b/internal/json/gojson.go new file mode 100644 index 00000000..376b89d4 --- /dev/null +++ b/internal/json/gojson.go @@ -0,0 +1,28 @@ +// Copyright 2021 The Xorm Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gojson + +package json + +import ( + gojson "github.com/goccy/go-json" +) + +func init() { + DefaultJSONHandler = GOjson{} +} + +// GOjson implements JSONInterface via gojson +type GOjson struct{} + +// Marshal implements JSONInterface +func (GOjson) Marshal(v interface{}) ([]byte, error) { + return gojson.Marshal(v) +} + +// Unmarshal implements JSONInterface +func (GOjson) Unmarshal(data []byte, v interface{}) error { + return gojson.Unmarshal(data, v) +} \ No newline at end of file -- 2.40.1 From 8ebe737012b9aa4f8ae03986d181c0bb169e2824 Mon Sep 17 00:00:00 2001 From: raizen666 Date: Thu, 15 Jul 2021 04:57:32 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'internal/json/gojson.?= =?UTF-8?q?go'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/json/gojson.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/json/gojson.go b/internal/json/gojson.go index 376b89d4..4f1448e7 100644 --- a/internal/json/gojson.go +++ b/internal/json/gojson.go @@ -25,4 +25,4 @@ func (GOjson) Marshal(v interface{}) ([]byte, error) { // Unmarshal implements JSONInterface func (GOjson) Unmarshal(data []byte, v interface{}) error { return gojson.Unmarshal(data, v) -} \ No newline at end of file +} -- 2.40.1