private accessor

This commit is contained in:
mr
2024-07-31 10:35:03 +02:00
parent 7ae1399a9a
commit 00fe19083b
10 changed files with 49 additions and 36 deletions

View File

@@ -70,10 +70,12 @@ func (wfa dataMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
return objs, 200, nil
}
func (wfa *dataMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
func (wfa *dataMongoAccessor) Search(word string, options ...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 len(options) == 0 {
options = []string{"abstractresource.abstractobject.name", "abstractresource.short_description", "abstractresource.description", "abstractresource.owner", "abstractresource.source_url"}
}
res_mongo, code, err := mongo.MONGOService.Search(word, options, wfa.GetType())
if err != nil {
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
return nil, code, err

View File

@@ -72,9 +72,12 @@ func (wfa datacenterMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, erro
return objs, 200, nil
}
func (wfa *datacenterMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
func (wfa *datacenterMongoAccessor) Search(word string, options ...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 len(options) == 0 {
options = []string{"abstractresource.abstractobject.name", "abstractresource.short_description", "abstractresource.description", "abstractresource.owner", "abstractresource.source_url"}
}
res_mongo, code, err := mongo.MONGOService.Search(word, options, wfa.GetType())
if err != nil {
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
return nil, code, err

View File

@@ -73,9 +73,12 @@ 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, options ...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 len(options) == 0 {
options = []string{"abstractresource.abstractobject.name", "abstractresource.short_description", "abstractresource.description", "abstractresource.owner", "abstractresource.source_url"}
}
res_mongo, code, err := mongo.MONGOService.Search(word, options, wfa.GetType())
if err != nil {
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
return nil, code, err

View File

@@ -73,9 +73,12 @@ func (wfa storageMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error)
return objs, 200, nil
}
func (wfa *storageMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
func (wfa *storageMongoAccessor) Search(word string, options ...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 len(options) == 0 {
options = []string{"abstractresource.abstractobject.name", "abstractresource.short_description", "abstractresource.description", "abstractresource.owner", "abstractresource.source_url"}
}
res_mongo, code, err := mongo.MONGOService.Search(word, options, wfa.GetType())
if err != nil {
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
return nil, code, err

View File

@@ -77,9 +77,12 @@ func (wfa workflowResourceMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int
return objs, 200, nil
}
func (wfa *workflowResourceMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
func (wfa *workflowResourceMongoAccessor) Search(word string, options ...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 len(options) == 0 {
options = []string{"abstractresource.abstractobject.name", "abstractresource.short_description", "abstractresource.description", "abstractresource.owner", "abstractresource.source_url"}
}
res_mongo, code, err := mongo.MONGOService.Search(word, options, wfa.GetType())
if err != nil {
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
return nil, code, err