Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Disconnect ¶ added in v0.0.2
func Disconnect(connection *Connection)
Disconnect closes the MongoDB client connection
Types ¶
type Collection ¶ added in v0.1.3
type Collection struct { Name string SingleFieldIndexes *[]*SingleFieldIndex CompoundIndexes *[]*CompoundFieldIndex }
Collection represents a MongoDB collection
func NewCollection ¶ added in v0.1.3
func NewCollection(name string, singleFieldIndexes *[]*SingleFieldIndex, compoundIndexes *[]*CompoundFieldIndex) *Collection
NewCollection creates a new MongoDB collection
func (*Collection) CreateCollection ¶ added in v0.1.5
func (c *Collection) CreateCollection(database *mongo.Database) (collection *mongo.Collection, err error)
CreateCollection creates the collection
type CompoundFieldIndex ¶ added in v0.1.3
type CompoundFieldIndex struct {
Model *mongo.IndexModel
}
CompoundFieldIndex represents a compound field index
func NewCompoundFieldIndex ¶ added in v0.1.3
func NewCompoundFieldIndex(fieldIndexes []*FieldIndex, unique bool) *CompoundFieldIndex
NewCompoundFieldIndex creates a new compound field index
type Connection ¶ added in v0.0.6
type Connection struct { Config *Config Client *mongo.Client Ctx context.Context Cancel context.CancelFunc }
func Connect ¶
func Connect(config *Config) (connection *Connection, err error)
Connect returns a new MongoDB client
type FieldIndex ¶ added in v0.1.3
func NewFieldIndex ¶ added in v0.1.3
func NewFieldIndex(name string, order Order) *FieldIndex
NewFieldIndex creates a new field index
type SingleFieldIndex ¶ added in v0.1.3
type SingleFieldIndex struct {
Model *mongo.IndexModel
}
func NewSingleFieldIndex ¶ added in v0.1.3
func NewSingleFieldIndex(fieldIndex FieldIndex, unique bool) *SingleFieldIndex
NewSingleFieldIndex creates a new single field index
Click to show internal directories.
Click to hide internal directories.