mongo

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	// contains filtered or unexported fields
}

func Connect

func Connect(ctx context.Context, logger tools.Logger, preferences Preferences) (*Mongo, error)

func (*Mongo) Close

func (m *Mongo) Close(ctx context.Context) error

func (*Mongo) Operation

func (m *Mongo) Operation(f func(db *mongo.Database) error) error

Operation executes a single operation on the database

func (*Mongo) Transaction

func (m *Mongo) Transaction(ctx context.Context, actions ...func(sessionCtx mongo.SessionContext, db *mongo.Database) error) error

Transaction executes a series of actions in a single transaction

type Preferences

type Preferences struct {
	URI  string `long:"uri" env:"URI" description:"MongoDB URI" required:"true"`
	Name string `long:"name" env:"NAME" description:"MongoDB database name" required:"true"`
}

Jump to

Keyboard shortcuts

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