mongo

package
v0.0.0-...-5bbb7b8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Collection(string, ...*options.CollectionOptions) *mongo.Collection
	Connect() context.CancelFunc
	Database() *mongo.Database
	DefineIndexes(...IndexSet)
}

Client defines the interface for a service's MongoDB connection.

func NewClient

func NewClient(dbName string) Client

NewClient creates a new MongoDB client for connecting to the specified database.

type IndexSet

type IndexSet struct {
	Collection string
	Indexes    []mongo.IndexModel
}

IndexSet specifies the indexes to create for the given collection.

func NewIndexSet

func NewIndexSet(collection string, indexes ...mongo.IndexModel) IndexSet

NewIndexSet creates a new IndexSet.

Jump to

Keyboard shortcuts

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