mongodb

package
v0.0.0-...-dc7611c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Module provided to fxlog
	// https://uber-go.github.io/fx/modules.html
	Module = fx.Module(
		"mongofx",
		mongoProviders,
		mongoInvokes,
	)
)

Functions

func NewMongoDB

func NewMongoDB(cfg *MongoDbOptions) (*mongo.Client, error)

NewMongoDB Create new MongoDB client

func NewMongoHealthChecker

func NewMongoHealthChecker(client *mongo.Client) health.Health

func Paginate

func Paginate[T any](
	ctx context.Context,
	listQuery *utils.ListQuery,
	collection *mongo.Collection,
	filter interface{},
) (*utils.ListResult[T], error)

Types

type MongoDbOptions

type MongoDbOptions struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
	UseAuth  bool   `mapstructure:"useAuth"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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