Explorar o código

新增json-iterator

dcsunny %!s(int64=4) %!d(string=hai) anos
pai
achega
87aac77690
Modificáronse 2 ficheiros con 37 adicións e 0 borrados
  1. 20 0
      json/json.go
  2. 17 0
      json/jsoniter.go

+ 20 - 0
json/json.go

@@ -0,0 +1,20 @@
+// Copyright 2017 Bo-Yi Wu.  All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+package json
+
+//import "encoding/json"
+//
+//var (
+//	// Marshal is exported by gin/json package.
+//	Marshal = json.Marshal
+//	// Unmarshal is exported by gin/json package.
+//	Unmarshal = json.Unmarshal
+//	// MarshalIndent is exported by gin/json package.
+//	MarshalIndent = json.MarshalIndent
+//	// NewDecoder is exported by gin/json package.
+//	NewDecoder = json.NewDecoder
+//	// NewEncoder is exported by gin/json package.
+//	NewEncoder = json.NewEncoder
+//)

+ 17 - 0
json/jsoniter.go

@@ -0,0 +1,17 @@
+// Copyright 2017 Bo-Yi Wu.  All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+//默认使用 json-iterator
+package json
+
+import jsoniter "git.ikuban.com/server/json"
+
+var (
+	json          = jsoniter.ConfigCompatibleWithStandardLibrary
+	Marshal       = json.Marshal
+	Unmarshal     = json.Unmarshal
+	MarshalIndent = json.MarshalIndent
+	NewDecoder    = json.NewDecoder
+	NewEncoder    = json.NewEncoder
+)