pointer of pointer is kicked out
This commit is contained in:
parent
b0f2cf46eb
commit
dbbda34117
@ -260,7 +260,7 @@ func (m *MongoDB) LoadOne(id string, collection_name string) (*mongo.SingleResul
|
||||
return res, 200, nil
|
||||
}
|
||||
|
||||
func (m *MongoDB) Search(filters dbs.Filters, collection_name string) (*mongo.Cursor, int, error) {
|
||||
func (m *MongoDB) Search(filters *dbs.Filters, collection_name string) (*mongo.Cursor, int, error) {
|
||||
if err := m.createClient(mngoConfig.GetUrl()); err != nil {
|
||||
return nil, 503, err
|
||||
}
|
||||
@ -268,21 +268,21 @@ func (m *MongoDB) Search(filters dbs.Filters, collection_name string) (*mongo.Cu
|
||||
opts.SetLimit(100)
|
||||
targetDBCollection := CollectionMap[collection_name]
|
||||
orList := bson.A{}
|
||||
for k, filter := range filters.Or {
|
||||
orList = append(orList, bson.M{
|
||||
k: bson.M{dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value)}})
|
||||
}
|
||||
f := bson.D{
|
||||
{"$or", orList},
|
||||
}
|
||||
if len(orList) == 0 {
|
||||
f = bson.D{}
|
||||
}
|
||||
for k, filter := range filters.And {
|
||||
f = append(f, bson.E{
|
||||
k, bson.M{
|
||||
dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value),
|
||||
}})
|
||||
f := bson.D{}
|
||||
if filters != nil {
|
||||
for k, filter := range filters.Or {
|
||||
orList = append(orList, bson.M{
|
||||
k: bson.M{dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value)}})
|
||||
}
|
||||
if len(orList) > 0 {
|
||||
f = bson.D{{"$or", orList}}
|
||||
}
|
||||
for k, filter := range filters.And {
|
||||
f = append(f, bson.E{
|
||||
k, bson.M{
|
||||
dbs.StringToOperator(filter.Operator).ToMongoOperator(): dbs.ToValueOperator(dbs.StringToOperator(filter.Operator), filter.Value),
|
||||
}})
|
||||
}
|
||||
}
|
||||
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
|
@ -63,7 +63,7 @@ func (wfa *ResourceModelMongoAccessor) Search(filters *dbs.Filters, search strin
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -84,7 +84,7 @@ func (wfa *dataMongoAccessor) Search(filters *dbs.Filters, search string) ([]uti
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -86,7 +86,7 @@ func (wfa *datacenterMongoAccessor) Search(filters *dbs.Filters, search string)
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -87,7 +87,7 @@ func (wfa *processingMongoAccessor) Search(filters *dbs.Filters, search string)
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -87,7 +87,7 @@ func (wfa *storageMongoAccessor) Search(filters *dbs.Filters, search string) ([]
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -91,7 +91,7 @@ func (wfa *workflowResourceMongoAccessor) Search(filters *dbs.Filters, search st
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -171,7 +171,7 @@ func (wfa *workflowMongoAccessor) Search(filters *dbs.Filters, search string) ([
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -60,7 +60,7 @@ func (wfa workflowExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, in
|
||||
|
||||
func (wfa *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
|
||||
objs := []utils.ShallowDBObject{}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(dbs.Filters{}, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(nil, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
@ -145,7 +145,7 @@ func (wfa *workspaceMongoAccessor) Search(filters *dbs.Filters, search string) (
|
||||
},
|
||||
}
|
||||
}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(*filters, wfa.GetType())
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
|
Loading…
Reference in New Issue
Block a user