Add views

This commit is contained in:
George Suntres
2026-04-16 11:17:16 -04:00
parent 9625489583
commit cba3e326e8
8 changed files with 328 additions and 7 deletions

15
main.go
View File

@@ -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
}
}