LoadAll evolve

This commit is contained in:
mr 2024-07-23 18:06:54 +02:00
parent aa7ce56174
commit b775298bb0
6 changed files with 12 additions and 17 deletions

View File

@ -2,7 +2,6 @@ package data
import (
mongo "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"
)
@ -46,9 +45,9 @@ func (wfa DataMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
return nil, code, err
}
for res_mongo.Next(mongo.MngoCtx) {
var obj resources.AbstractResource
var obj DataResource
res_mongo.Decode(&obj)
objs = append(objs, &obj)
objs = append(objs, &obj.AbstractResource)
}
return objs, 200, nil
}

View File

@ -2,7 +2,6 @@ package datacenter
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"
)
@ -48,9 +47,9 @@ func (wfa DatacenterMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, erro
return nil, code, err
}
for res_mongo.Next(mongo.MngoCtx) {
var obj resources.AbstractResource
var obj DatacenterResource
res_mongo.Decode(&obj)
objs = append(objs, &obj)
objs = append(objs, &obj.AbstractResource)
}
return objs, 200, nil
}

View File

@ -2,7 +2,6 @@ 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"
)
@ -49,9 +48,9 @@ func (wfa ProcessingMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, erro
return nil, code, err
}
for res_mongo.Next(mongo.MngoCtx) {
var obj resources.AbstractResource
var obj ProcessingResource
res_mongo.Decode(&obj)
objs = append(objs, &obj)
objs = append(objs, &obj.AbstractResource)
}
return objs, 200, nil
}

View File

@ -2,7 +2,6 @@ package storage
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"
)
@ -49,9 +48,9 @@ func (wfa StorageMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error)
return nil, code, err
}
for res_mongo.Next(mongo.MngoCtx) {
var obj resources.AbstractResource
var obj StorageResource
res_mongo.Decode(&obj)
objs = append(objs, &obj)
objs = append(objs, &obj.AbstractResource)
}
return objs, 200, nil
}

View File

@ -2,7 +2,6 @@ package oclib
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"
)
@ -52,9 +51,9 @@ func (wfa WorkflowResourceMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int
return nil, code, err
}
for res_mongo.Next(mongo.MngoCtx) {
var obj resources.AbstractResource
var obj WorkflowResource
res_mongo.Decode(&obj)
objs = append(objs, &obj)
objs = append(objs, &obj.AbstractResource)
}
return objs, 200, nil
}

View File

@ -100,9 +100,9 @@ func (wfa WorkflowMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error)
return nil, code, err
}
for res_mongo.Next(mongo.MngoCtx) {
var obj utils.AbstractObject
var obj Workflow
res_mongo.Decode(&obj)
objs = append(objs, &obj)
objs = append(objs, &obj.AbstractObject)
}
return objs, 200, nil
}