mongoDBConnection

package
v3.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Lowest-level code to connect to Mongo DB (locally in Docker and remotely) and get consistant collection names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToLocalMongoDB

func ConnectToLocalMongoDB(log logger.ILogger) (*mongo.Client, error)

Assumes local mongo running in docker as per this command: docker run -d --name mongo-on-docker -p 27888:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo

func ConnectToRemoteMongoDB

func ConnectToRemoteMongoDB(
	MongoEndpoint string,
	MongoUsername string,
	MongoPassword string,
	log logger.ILogger,
) (*mongo.Client, error)

func GetDatabaseName

func GetDatabaseName(dbName string, envName string) string

Types

type MongoConnectionInfo

type MongoConnectionInfo struct {
	DbClusterIdentifier string `json:"dbClusterIdentifier"`
	Password            string `json:"password"`
	Engine              string `json:"engine"`
	Port                string `json:"port"`
	Host                string `json:"host"`
	Ssl                 string `json:"ssl"`
	Username            string `json:"username"`
}

func GetMongoConnectionInfoFromSecretCache

func GetMongoConnectionInfoFromSecretCache(session *session.Session, secretName string) (MongoConnectionInfo, error)

Jump to

Keyboard shortcuts

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