Documentation ¶
Index ¶
- Variables
- func Set(db *Database)
- type Database
- func (db *Database) CheckAndFixVisTokenCounts(ctx context.Context, checkOnly bool) (map[string]map[string]map[string]int, error)
- func (db *Database) DbPropsCollection() *mongo.Collection
- func (db *Database) GetSchemaVersion(ctx context.Context) (int, int, error)
- func (db *Database) UpdateIndexes() error
- func (db *Database) UpdateIndexesTo(version int) error
- func (db *Database) UpdateSchemas() error
- func (db *Database) UpdateSchemasTo(version int) error
Constants ¶
This section is empty.
Variables ¶
var MongoDatabaseName = utils.GetCloudProjectID()
MongoDatabaseName is the name of the database in MongoDB
Functions ¶
Types ¶
type Database ¶
Database interface abstracts database operations
func (*Database) CheckAndFixVisTokenCounts ¶ added in v1.20.4
func (db *Database) CheckAndFixVisTokenCounts(ctx context.Context, checkOnly bool) (map[string]map[string]map[string]int, error)
Check vis token counts in all collections. If called in checkOnly mode, only does checks otherwise will also update vis token counts.
If there are any errors, errors are returned in a map with structure: returnedMap[<groupType> + <id>]["visTokenCounts" | "descVisTokenCounts"][<token>] = delta where delta is difference between actual count and expected count.
func (*Database) DbPropsCollection ¶ added in v0.11.0
func (db *Database) DbPropsCollection() *mongo.Collection
DbPropsCollection is the collection for database properties
func (*Database) GetSchemaVersion ¶ added in v1.0.0
GetSchemaVersion returns (cur, latest) schema version
func (*Database) UpdateIndexes ¶ added in v0.11.0
UpdateIndexes if necessary
func (*Database) UpdateIndexesTo ¶ added in v0.11.0
UpdateIndexesTo to a particular version
func (*Database) UpdateSchemas ¶ added in v1.0.0
UpdateSchemas if necessary
func (*Database) UpdateSchemasTo ¶ added in v1.0.0
UpdateSchemasTo to a particular version