mongo

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToConnectToMongo   = errors.New("failed to connect to mongo")
	ErrFailedToPingMongo        = errors.New("failed to ping mongo")
	ErrFailedToCreateCollection = errors.New("failed to create collection")
	ErrInvalidType              = errors.New("data must be a struct or a pointer to a struct")
	ErrInsertFailed             = errors.New("failed to insert data")
	ErrNotIdentifiable          = errors.New("entity does not implement contract.Identifiable")
	ErrFindFailed               = errors.New("failed to find document")
	ErrDecodeFailed             = errors.New("failed to decode document")
	ErrNoDocument               = errors.New("no document found")
	ErrDeleteFailed             = errors.New("failed to delete document")
	ErrReplaceFailed            = errors.New("failed to replace document")
	ErrSessionInit              = errors.New("failed to initialize session")
	ErrTransactionInit          = errors.New("failed to start transaction")
	ErrValueConversion          = errors.New("failed to convert value")
	ErrUnsupportedType          = errors.New("unsupported type in query map")
	ErrWatchFailed              = errors.New("failed to watch collection or database")
	ErrCloseFailed              = errors.New("failed to close change stream")
	ErrProcessingChangeStream   = errors.New("error processing change stream")
)

Functions

func DefaultMongoClientOptions

func DefaultMongoClientOptions(connString, appName string, maxPoolSize uint64, maxConnIdleTime, timeout time.Duration) *options.ClientOptions

func NewMongoClient

func NewMongoClient(ctx context.Context, retryOpts helper.RetryOptions, opts options.ClientOptions) (contract.MongoClient, error)

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *defaultTool

Types

type Blackbox

type Blackbox interface {
	// contains filtered or unexported methods
}

type Client

type Client interface {
	Blackbox
	contract.DBOperator
	contract.MongoOperator
}

func NewClient

func NewClient(c contract.MongoClient) (Client, error)

Jump to

Keyboard shortcuts

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