mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
review
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"mayfly-go/pkg/ginx"
|
||||
"mayfly-go/pkg/model"
|
||||
"mayfly-go/pkg/req"
|
||||
"mayfly-go/pkg/utils/jsonx"
|
||||
"mayfly-go/pkg/utils/collx"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -93,7 +93,7 @@ func (m *Mongo) RunCommand(rc *req.Ctx) {
|
||||
ginx.BindJsonAndValid(rc.GinCtx, commandForm)
|
||||
|
||||
inst := m.MongoApp.GetMongoInst(m.GetMongoId(rc.GinCtx))
|
||||
rc.ReqParam = jsonx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
rc.ReqParam = collx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
|
||||
// 顺序执行
|
||||
commands := bson.D{}
|
||||
@@ -156,7 +156,7 @@ func (m *Mongo) UpdateByIdCommand(rc *req.Ctx) {
|
||||
ginx.BindJsonAndValid(g, commandForm)
|
||||
|
||||
inst := m.MongoApp.GetMongoInst(m.GetMongoId(g))
|
||||
rc.ReqParam = jsonx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
rc.ReqParam = collx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
|
||||
// 解析docId文档id,如果为string类型则使用ObjectId解析,解析失败则为普通字符串
|
||||
docId := commandForm.DocId
|
||||
@@ -180,7 +180,7 @@ func (m *Mongo) DeleteByIdCommand(rc *req.Ctx) {
|
||||
ginx.BindJsonAndValid(g, commandForm)
|
||||
|
||||
inst := m.MongoApp.GetMongoInst(m.GetMongoId(g))
|
||||
rc.ReqParam = jsonx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
rc.ReqParam = collx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
|
||||
// 解析docId文档id,如果为string类型则使用ObjectId解析,解析失败则为普通字符串
|
||||
docId := commandForm.DocId
|
||||
@@ -203,7 +203,7 @@ func (m *Mongo) InsertOneCommand(rc *req.Ctx) {
|
||||
ginx.BindJsonAndValid(g, commandForm)
|
||||
|
||||
inst := m.MongoApp.GetMongoInst(m.GetMongoId(g))
|
||||
rc.ReqParam = jsonx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
rc.ReqParam = collx.Kvs("mongo", inst.Info, "cmd", commandForm)
|
||||
|
||||
res, err := inst.Cli.Database(commandForm.Database).Collection(commandForm.Collection).InsertOne(context.TODO(), commandForm.Doc)
|
||||
biz.ErrIsNilAppendErr(err, "命令执行失败: %s")
|
||||
|
||||
Reference in New Issue
Block a user