mongo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(c *Config) (*mongo.Client, error)

Types

type Config

type Config struct {
	Host          string
	Port          string
	User          string
	Password      string
	Database      string
	MigrationPath string
}

Config holds all values used to configure and connect to a postgres db.

func (*Config) Check

func (c *Config) Check() func(ctx context.Context) error

Check allows to probe the liveness of mongo database.

func (*Config) ConnectAndMigrate

func (c *Config) ConnectAndMigrate(logger *zap.Logger) (*Handler, error)

Connect establishes a connection to the database based on the configuration provided.

func (*Config) ToDSN

func (c *Config) ToDSN() string

type Handler

type Handler struct {
	Client *mongo.Client
}

Handler holds a connection to the nosql database

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context) error

Shutdown closes all connections.

Jump to

Keyboard shortcuts

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