Add views
This commit is contained in:
15
main.go
15
main.go
@@ -39,12 +39,13 @@ type IMongoClient interface {
|
||||
}
|
||||
|
||||
type CollectionDefinition struct {
|
||||
Name string `bson:"_name"`
|
||||
Singular string `bson:"singular"`
|
||||
Plural string `bson: "plural"`
|
||||
IdPrefix string `bson: "idPrefix"`
|
||||
IndexSpecs []map[string]any `bson: "indexSpecs"`
|
||||
Schema map[string]any `bson: "schema"`
|
||||
Name string `bson:"_name"`
|
||||
Singular string `bson:"singular"`
|
||||
Plural string `bson:"plural"`
|
||||
IdPrefix string `bson:"idPrefix"`
|
||||
IndexSpecs []map[string]any `bson:"indexSpecs"`
|
||||
Schema map[string]any `bson:"schema"`
|
||||
Views map[string]any `bson:"views"`
|
||||
}
|
||||
|
||||
// func (cd *CollectionDefinition) GetSchema(name string)
|
||||
@@ -168,6 +169,8 @@ func (c *MongoClient) GetCollection(database, name string) *mongo.Collection {
|
||||
|
||||
c.CreateIndexes(collection, cdef)
|
||||
|
||||
c.CreateViews(db, cdef)
|
||||
|
||||
return collection
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user