Shallow Get All
This commit is contained in:
@@ -2,6 +2,7 @@ package processing
|
||||
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
)
|
||||
|
||||
@@ -39,3 +40,18 @@ func (pma *ProcessingMongoAccessor) LoadOne(id string) (utils.DBObject, int, err
|
||||
|
||||
return &processing, 200, nil
|
||||
}
|
||||
|
||||
func (wfa ProcessingMongoAccessor) 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 resources.AbstractResource
|
||||
res_mongo.Decode(&obj)
|
||||
objs = append(objs, &obj)
|
||||
}
|
||||
return objs, 200, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user