logs update
This commit is contained in:
parent
e23756eba6
commit
fa52c71e93
@ -101,8 +101,8 @@ func ToValueOperator(operator Operator, value interface{}) interface{} {
|
||||
}
|
||||
|
||||
type Filters struct {
|
||||
And map[string]Filter `json:"and"`
|
||||
Or map[string]Filter `json:"or"`
|
||||
And map[string][]Filter `json:"and"`
|
||||
Or map[string][]Filter `json:"or"`
|
||||
}
|
||||
|
||||
type Filter struct {
|
||||
|
@ -267,13 +267,17 @@ func (m *MongoDB) Search(filters *dbs.Filters, collection_name string) (*mongo.C
|
||||
f := bson.D{}
|
||||
if filters != nil {
|
||||
for k, filter := range filters.Or {
|
||||
orList = append(orList, dbs.StringToOperator(filter.Operator).ToMongoOperator(k, filter.Value))
|
||||
for _, ff := range filter {
|
||||
orList = append(orList, dbs.StringToOperator(ff.Operator).ToMongoOperator(k, ff.Value))
|
||||
}
|
||||
}
|
||||
if len(orList) > 0 {
|
||||
f = bson.D{{"$or", orList}}
|
||||
}
|
||||
for k, filter := range filters.And {
|
||||
f = append(f, dbs.StringToOperator(filter.Operator).ToMongoEOperator(k, filter.Value))
|
||||
for _, ff := range filter {
|
||||
f = append(f, dbs.StringToOperator(ff.Operator).ToMongoEOperator(k, ff.Value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ func (wfa *ResourceModelMongoAccessor) Search(filters *dbs.Filters, search strin
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"resource_type": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"resource_type": []dbs.Filter{{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -75,12 +75,12 @@ func (wfa *dataMongoAccessor) Search(filters *dbs.Filters, search string) ([]uti
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.short_description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.owner": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.source_url": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.owner": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.source_url": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -77,12 +77,12 @@ func (wfa *datacenterMongoAccessor) Search(filters *dbs.Filters, search string)
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.short_description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.owner": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.source_url": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.owner": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.source_url": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -78,12 +78,12 @@ func (wfa *processingMongoAccessor) Search(filters *dbs.Filters, search string)
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.short_description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.owner": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.source_url": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.owner": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.source_url": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -78,12 +78,12 @@ func (wfa *storageMongoAccessor) Search(filters *dbs.Filters, search string) ([]
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.short_description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.owner": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.source_url": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.owner": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.source_url": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ func (wfa *workflowResourceMongoAccessor) Search(filters *dbs.Filters, search st
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.short_description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.description": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.owner": {Operator: dbs.LIKE.String(), Value: search},
|
||||
"abstractresource.source_url": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.owner": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
"abstractresource.source_url": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -47,15 +47,15 @@ func (dma *AbstractAccessor) SetLogger(t DataType) {
|
||||
func (wfa *AbstractAccessor) GenericStoreOne(data DBObject, accessor Accessor) (DBObject, int, error) {
|
||||
data.GenerateID()
|
||||
f := dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractresource.abstractobject.name": {{
|
||||
Operator: dbs.LIKE.String(),
|
||||
Value: data.GetName(),
|
||||
},
|
||||
"abstractobject.name": {
|
||||
}},
|
||||
"abstractobject.name": {{
|
||||
Operator: dbs.LIKE.String(),
|
||||
Value: data.GetName(),
|
||||
},
|
||||
}},
|
||||
},
|
||||
}
|
||||
if cursor, _, _ := accessor.Search(&f, ""); len(cursor) > 0 {
|
||||
|
@ -101,8 +101,8 @@ func (wfa *workflowMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject,
|
||||
func (wfa *workflowMongoAccessor) execute(workflow *Workflow) {
|
||||
accessor := (&workspace.Workspace{}).GetAccessor()
|
||||
filters := &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractobject.name": {dbs.LIKE.String(), workflow.Name + "_workspace"},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractobject.name": {{dbs.LIKE.String(), workflow.Name + "_workspace"}},
|
||||
},
|
||||
}
|
||||
resource, _, err := accessor.Search(filters, "")
|
||||
@ -166,8 +166,8 @@ func (wfa *workflowMongoAccessor) Search(filters *dbs.Filters, search string) ([
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +140,8 @@ func (wfa *workspaceMongoAccessor) Search(filters *dbs.Filters, search string) (
|
||||
objs := []utils.ShallowDBObject{}
|
||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||
filters = &dbs.Filters{
|
||||
Or: map[string]dbs.Filter{
|
||||
"abstractobject.name": {Operator: dbs.LIKE.String(), Value: search},
|
||||
Or: map[string][]dbs.Filter{
|
||||
"abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user