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

@@ -53,9 +53,12 @@ func (wfa ResourceModelMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, e
return objs, 200, nil
}
func (wfa *ResourceModelMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
func (wfa *ResourceModelMongoAccessor) Search(word string, options ...string) ([]utils.ShallowDBObject, int, error) {
objs := []utils.ShallowDBObject{}
res_mongo, code, err := mongo.MONGOService.Search(word, []string{"resource_type"}, wfa.GetType())
if len(options) == 0 {
options = []string{"resource_type"}
}
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