private accessor
This commit is contained in:
@@ -17,9 +17,6 @@ type ProcessingResource struct {
|
||||
Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"`
|
||||
ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"`
|
||||
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"`
|
||||
|
||||
// Price uint `bson:"price,omitempty" json:"price,omitempty"`
|
||||
// License string `bson:"license,omitempty" json:"license,omitempty"`
|
||||
}
|
||||
|
||||
func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||
@@ -42,7 +39,7 @@ func (dma *ProcessingResource) Serialize() map[string]interface{} {
|
||||
}
|
||||
|
||||
func (d *ProcessingResource) GetAccessor() utils.Accessor {
|
||||
data := &ProcessingMongoAccessor{}
|
||||
data := New()
|
||||
data.SetLogger(utils.PROCESSING_RESOURCE)
|
||||
return data
|
||||
}
|
||||
|
@@ -6,29 +6,33 @@ import (
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
)
|
||||
|
||||
type ProcessingMongoAccessor struct {
|
||||
type processingMongoAccessor struct {
|
||||
utils.AbstractAccessor
|
||||
}
|
||||
|
||||
func (pma *ProcessingMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
||||
func New() *processingMongoAccessor {
|
||||
return &processingMongoAccessor{}
|
||||
}
|
||||
|
||||
func (pma *processingMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
||||
return pma.GenericDeleteOne(id, pma)
|
||||
}
|
||||
|
||||
func (pma *ProcessingMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||
func (pma *processingMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||
set.(*ProcessingResource).ResourceModel = nil
|
||||
return pma.GenericUpdateOne(set, id, pma, &ProcessingResource{})
|
||||
}
|
||||
|
||||
func (pma *ProcessingMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
func (pma *processingMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
data.(*ProcessingResource).ResourceModel = nil
|
||||
return pma.GenericStoreOne(data, pma)
|
||||
}
|
||||
|
||||
func (pma *ProcessingMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
func (pma *processingMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||
return pma.GenericStoreOne(data, pma)
|
||||
}
|
||||
|
||||
func (pma *ProcessingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
func (pma *processingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
|
||||
var processing ProcessingResource
|
||||
|
||||
@@ -47,7 +51,7 @@ func (pma *ProcessingMongoAccessor) LoadOne(id string) (utils.DBObject, int, err
|
||||
return &processing, 200, nil
|
||||
}
|
||||
|
||||
func (wfa ProcessingMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
|
||||
func (wfa processingMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
|
||||
objs := []utils.ShallowDBObject{}
|
||||
res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType())
|
||||
if err != nil {
|
||||
@@ -69,7 +73,7 @@ func (wfa ProcessingMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, erro
|
||||
return objs, 200, nil
|
||||
}
|
||||
|
||||
func (wfa *ProcessingMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
|
||||
func (wfa *processingMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
|
||||
objs := []utils.ShallowDBObject{}
|
||||
res_mongo, code, err := mongo.MONGOService.Search(word, []string{"abstractresource.abstractobject.name", "abstractresource.short_description", "abstractresource.description", "abstractresource.owner", "abstractresource.source_url"}, wfa.GetType())
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user