Browse Source

新增json-iterator

dcsunny 4 năm trước cách đây
mục cha
commit
87aac77690
2 tập tin đã thay đổi với 37 bổ sung0 xóa
  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
+)