mongo

package
v0.0.0-...-0f2f850 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDb

func ConnectDb(mongoUri string, timeout time.Duration)

ConnectDb connects to MongoDB

func GetMongoDbConnector

func GetMongoDbConnector(db string, collection string) model.DbConnector

GetMongoDbConnector initialize and return model.DbConnector MongoDB instance

Types

type Config

type Config struct {
	Uri        string // MongoDB URI: mongodb://127.0.0.1:27017/?directConnection=true
	Db         string // MongoDB database name to use: test
	Collection string // Collection name to use: url-shortener
}

Config MongoDB credentials struct

func ParseConfig

func ParseConfig(configFile string) (error, Config)

ParseConfig parses given configuration file and initialize Config object

func (*Config) String

func (c *Config) String() string

String marshal the Config struct for pretty string representation

Jump to

Keyboard shortcuts

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