improve testing
This commit is contained in:
parent
4fd22dc131
commit
90e9bcf378
46
mongo/mongo_utils.go
Normal file
46
mongo/mongo_utils.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package mongo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Will store the created collection object for a faster access
|
||||||
|
var CollectionMap map[string]*mongo.Collection
|
||||||
|
var IndexesMap map[string][]mongo.IndexModel
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
CollectionMap = make(map[string]*mongo.Collection)
|
||||||
|
IndexesMap = make(map[string][]mongo.IndexModel)
|
||||||
|
|
||||||
|
IndexesMap["data"] = append(IndexesMap["data"], mongo.IndexModel{Keys: bson.D{
|
||||||
|
{Key: "description", Value:"text"},
|
||||||
|
{Key: "example", Value:"text"}},
|
||||||
|
})
|
||||||
|
|
||||||
|
IndexesMap["datacenter"] = append(IndexesMap["datacenter"], mongo.IndexModel{Keys: bson.D{
|
||||||
|
{Key: "description", Value:"text"},
|
||||||
|
{Key: "example", Value:"text"},
|
||||||
|
{Key: "owner", Value:"text"}},
|
||||||
|
})
|
||||||
|
|
||||||
|
IndexesMap["storage"] = append(IndexesMap["storage"], mongo.IndexModel{Keys: bson.D{
|
||||||
|
{Key: "description", Value:"text"},
|
||||||
|
{Key: "example", Value:"text"}},
|
||||||
|
})
|
||||||
|
|
||||||
|
IndexesMap["processing"] = append(IndexesMap["processing"], mongo.IndexModel{Keys: bson.D{
|
||||||
|
{Key: "description", Value:"text"},
|
||||||
|
{Key: "example", Value:"text"},
|
||||||
|
{Key: "owner", Value:"text"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
IndexesMap["workflow"] = append(IndexesMap["workflow"], mongo.IndexModel{Keys: bson.D{
|
||||||
|
{Key: "description", Value:"text"},
|
||||||
|
{Key: "example", Value:"text"},
|
||||||
|
{Key: "owner", Value:"text"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
1
tests/config.go
Normal file
1
tests/config.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package tests
|
Loading…
Reference in New Issue
Block a user