From 56cd6610948e949da4e7d2c67c80cc95f8bca484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A7=E9=A9=8A?= Date: Tue, 24 Dec 2024 19:04:03 +0800 Subject: [PATCH] feat: add mongo --- errs/error_code.go | 5 +++-- go.work | 2 +- {storage/mongo => mongo}/config.go | 0 {storage/mongo => mongo}/const.go | 0 {storage/mongo => mongo}/custom_mongo_decimal.go | 0 {storage/mongo => mongo}/doc-db-with-cache.go | 1 + {storage/mongo => mongo}/doc-db.go | 7 ++++--- {storage/mongo => mongo}/go.mod | 0 {storage/mongo => mongo}/option.go | 0 {storage/mongo => mongo}/usecase.go | 1 + 10 files changed, 10 insertions(+), 6 deletions(-) rename {storage/mongo => mongo}/config.go (100%) rename {storage/mongo => mongo}/const.go (100%) rename {storage/mongo => mongo}/custom_mongo_decimal.go (100%) rename {storage/mongo => mongo}/doc-db-with-cache.go (99%) rename {storage/mongo => mongo}/doc-db.go (99%) rename {storage/mongo => mongo}/go.mod (100%) rename {storage/mongo => mongo}/option.go (100%) rename {storage/mongo => mongo}/usecase.go (99%) diff --git a/errs/error_code.go b/errs/error_code.go index d5e9eea..2bbb313 100644 --- a/errs/error_code.go +++ b/errs/error_code.go @@ -1,10 +1,11 @@ package errs import ( - "code.30cm.net/digimon/library-go/errs/code" "fmt" - "github.com/zeromicro/go-zero/core/logx" "strings" + + "code.30cm.net/digimon/library-go/errs/code" + "github.com/zeromicro/go-zero/core/logx" ) type ErrorCode uint32 diff --git a/go.work b/go.work index e6ab84c..e0798e1 100644 --- a/go.work +++ b/go.work @@ -4,7 +4,7 @@ use ( . ./errs ./jwt - ./storage/mongo + ./mongo ./utils/bitmap ./utils/invited_code ./validator diff --git a/storage/mongo/config.go b/mongo/config.go similarity index 100% rename from storage/mongo/config.go rename to mongo/config.go diff --git a/storage/mongo/const.go b/mongo/const.go similarity index 100% rename from storage/mongo/const.go rename to mongo/const.go diff --git a/storage/mongo/custom_mongo_decimal.go b/mongo/custom_mongo_decimal.go similarity index 100% rename from storage/mongo/custom_mongo_decimal.go rename to mongo/custom_mongo_decimal.go diff --git a/storage/mongo/doc-db-with-cache.go b/mongo/doc-db-with-cache.go similarity index 99% rename from storage/mongo/doc-db-with-cache.go rename to mongo/doc-db-with-cache.go index f993558..1484aa2 100755 --- a/storage/mongo/doc-db-with-cache.go +++ b/mongo/doc-db-with-cache.go @@ -3,6 +3,7 @@ package mongo import ( "context" "fmt" + "github.com/zeromicro/go-zero/core/stores/cache" "github.com/zeromicro/go-zero/core/stores/mon" "go.mongodb.org/mongo-driver/mongo" diff --git a/storage/mongo/doc-db.go b/mongo/doc-db.go similarity index 99% rename from storage/mongo/doc-db.go rename to mongo/doc-db.go index ea71246..ea6d034 100755 --- a/storage/mongo/doc-db.go +++ b/mongo/doc-db.go @@ -4,15 +4,16 @@ import ( "context" "errors" "fmt" + "net/url" + "strings" + "time" + "github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/stores/mon" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/readpref" - "net/url" - "strings" - "time" ) type DocumentDB struct { diff --git a/storage/mongo/go.mod b/mongo/go.mod similarity index 100% rename from storage/mongo/go.mod rename to mongo/go.mod diff --git a/storage/mongo/option.go b/mongo/option.go similarity index 100% rename from storage/mongo/option.go rename to mongo/option.go diff --git a/storage/mongo/usecase.go b/mongo/usecase.go similarity index 99% rename from storage/mongo/usecase.go rename to mongo/usecase.go index b1bc570..cbc9090 100644 --- a/storage/mongo/usecase.go +++ b/mongo/usecase.go @@ -2,6 +2,7 @@ package mongo import ( "context" + "github.com/zeromicro/go-zero/core/stores/mon" "go.mongodb.org/mongo-driver/mongo" mopt "go.mongodb.org/mongo-driver/mongo/options"