mongoutils

package
v0.0.0-...-d2a8444 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryToUuid

func BinaryToUuid(id interface{}) uuid.UUID

func ProvideMongoClient

func ProvideMongoClient(
	lc fx.Lifecycle,
	logger *zap.Logger,
	cfg *MongoConfig,
) (*mongo.Client, error)

func ProvideMongoDatabase

func ProvideMongoDatabase(
	client *mongo.Client,
	cfg *MongoConfig,
) *mongo.Database

func SetRegistryForUuids

func SetRegistryForUuids(
	opts *options.ClientOptions,
) *options.ClientOptions

SetRegistryForUuids sets the registry for mongodb such that it can encode and decode primitive.Binary UUIDs into google/uuid.UUID type

Types

type MongoConfig

type MongoConfig struct {
	MongoUri string `mapstructure:"MONGO_URI"`
	MongoDB  string `mapstructure:"MONGO_DB"`
}

func ProvideMongoConfig

func ProvideMongoConfig(cl *utils.ConfigLocation) (*MongoConfig, error)

Jump to

Keyboard shortcuts

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