From 5154d98a88b5e5da446dfbae30e570297e5da2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Sun, 1 May 2022 08:50:34 +0800 Subject: [PATCH] add json --- app.go | 2 +- bson.go | 1 + json.go | 10 ++++++++++ xml.go | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 bson.go create mode 100644 json.go create mode 100644 xml.go diff --git a/app.go b/app.go index 927a6c8..ec1174f 100644 --- a/app.go +++ b/app.go @@ -8,7 +8,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" ) -const Version = "1.0.4" +const Version = "1.0.5" type Client struct { Db *mongo.Client // 驱动 diff --git a/bson.go b/bson.go new file mode 100644 index 0000000..88e9471 --- /dev/null +++ b/bson.go @@ -0,0 +1 @@ +package gomongo diff --git a/json.go b/json.go new file mode 100644 index 0000000..7eb032a --- /dev/null +++ b/json.go @@ -0,0 +1,10 @@ +package gomongo + +import "encoding/json" + +// JsonDecodeNoError Json解码,不报错 +func JsonDecodeNoError(b []byte) map[string]interface{} { + var data map[string]interface{} + _ = json.Unmarshal(b, &data) + return data +} diff --git a/xml.go b/xml.go new file mode 100644 index 0000000..88e9471 --- /dev/null +++ b/xml.go @@ -0,0 +1 @@ +package gomongo