Shallow Get All
This commit is contained in:
@@ -35,3 +35,18 @@ func (wfa *WorkflowMongoAccessor) LoadOne(id string) (utils.DBObject, int, error
|
||||
res_mongo.Decode(&workflow)
|
||||
return &workflow, 200, nil
|
||||
}
|
||||
|
||||
func (wfa WorkflowMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
|
||||
objs := []utils.ShallowDBObject{}
|
||||
res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType())
|
||||
if err != nil {
|
||||
wfa.Logger.Error().Msg("Could not retrieve any from db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
}
|
||||
for res_mongo.Next(mongo.MngoCtx) {
|
||||
var obj utils.AbstractObject
|
||||
res_mongo.Decode(&obj)
|
||||
objs = append(objs, &obj)
|
||||
}
|
||||
return objs, 200, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user