database

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoDatabaseName = utils.GetCloudProjectID()

MongoDatabaseName is the name of the database in MongoDB

Functions

func Set

func Set(db *Database)

Set the database object to use

Types

type Database

type Database struct {
	Mdb *mongo.Database

	apis.APIs
}

Database interface abstracts database operations

func Get

func Get() *Database

Get the database object to use

func New

func New() (*Database, error)

New returns a new database object that connects to the real database

func NewWithDb

func NewWithDb(mdb *mongo.Database) *Database

NewWithDb returns a new database object with the given Mongo database

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

func (db *Database) GetSchemaVersion(ctx context.Context) (int, int, error)

GetSchemaVersion returns (cur, latest) schema version

func (*Database) UpdateIndexes added in v0.11.0

func (db *Database) UpdateIndexes() error

UpdateIndexes if necessary

func (*Database) UpdateIndexesTo added in v0.11.0

func (db *Database) UpdateIndexesTo(version int) error

UpdateIndexesTo to a particular version

func (*Database) UpdateSchemas added in v1.0.0

func (db *Database) UpdateSchemas() error

UpdateSchemas if necessary

func (*Database) UpdateSchemasTo added in v1.0.0

func (db *Database) UpdateSchemasTo(version int) error

UpdateSchemasTo to a particular version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL