nil except
This commit is contained in:
parent
ed4cb943a8
commit
9da3a7c3e6
@ -3,7 +3,6 @@ package mongo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
@ -226,7 +225,6 @@ func (m *MongoDB) StoreOne(obj interface{}, id string, collection_name string) (
|
|||||||
bson.Unmarshal(b, &doc)
|
bson.Unmarshal(b, &doc)
|
||||||
doc["_id"] = id
|
doc["_id"] = id
|
||||||
targetDBCollection := CollectionMap[collection_name]
|
targetDBCollection := CollectionMap[collection_name]
|
||||||
fmt.Println("DB", collection_name, targetDBCollection, CollectionMap)
|
|
||||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -285,7 +283,6 @@ func (m *MongoDB) Search(filters *dbs.Filters, collection_name string) (*mongo.C
|
|||||||
|
|
||||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
fmt.Println("FILTER", f)
|
|
||||||
if cursor, err := targetDBCollection.Find(
|
if cursor, err := targetDBCollection.Find(
|
||||||
MngoCtx,
|
MngoCtx,
|
||||||
f,
|
f,
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package oclib
|
package oclib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
"cloud.o-forge.io/core/oc-lib/logs"
|
"cloud.o-forge.io/core/oc-lib/logs"
|
||||||
@ -115,7 +113,6 @@ func LoadOne(collection LibDataEnum, id string) LibData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UpdateOne(collection LibDataEnum, set map[string]interface{}, id string) LibData {
|
func UpdateOne(collection LibDataEnum, set map[string]interface{}, id string) LibData {
|
||||||
fmt.Println(set)
|
|
||||||
model := models.Model(collection.EnumIndex())
|
model := models.Model(collection.EnumIndex())
|
||||||
d, code, err := model.GetAccessor().UpdateOne(model.Deserialize(set), id)
|
d, code, err := model.GetAccessor().UpdateOne(model.Deserialize(set), id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -134,7 +131,6 @@ func DeleteOne(collection LibDataEnum, id string) LibData {
|
|||||||
|
|
||||||
func StoreOne(collection LibDataEnum, object map[string]interface{}) LibData {
|
func StoreOne(collection LibDataEnum, object map[string]interface{}) LibData {
|
||||||
model := models.Model(collection.EnumIndex())
|
model := models.Model(collection.EnumIndex())
|
||||||
fmt.Println(object)
|
|
||||||
d, code, err := model.GetAccessor().StoreOne(model.Deserialize(object))
|
d, code, err := model.GetAccessor().StoreOne(model.Deserialize(object))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return LibData{Data: d, Code: code, Err: err.Error()}
|
return LibData{Data: d, Code: code, Err: err.Error()}
|
||||||
|
Loading…
Reference in New Issue
Block a user