mongoDB

package
v0.0.0-...-b89426d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDBClient

type MongoDBClient struct {
	MongoDB *mongo.Client
}

func ConnectToMongoDB

func ConnectToMongoDB(mongoDBClientConfig *MongoDBClientConfigData) (*MongoDBClient, error)

func (*MongoDBClient) CountDocumentsInMongo

func (client *MongoDBClient) CountDocumentsInMongo(databaseName string, collection string) (int, error)

func (*MongoDBClient) DatabaseExists

func (client *MongoDBClient) DatabaseExists(nameDatabase string) (bool, error)

func (*MongoDBClient) FindDocumentsInMongo

func (client *MongoDBClient) FindDocumentsInMongo(databaseName string, collection string, interval int, skip int, result interface{}) error

func (*MongoDBClient) GetAllCollections

func (client *MongoDBClient) GetAllCollections(nameDatabase string) ([]string, error)

type MongoDBClientConfigData

type MongoDBClientConfigData struct {
	Scheme   string
	Username string
	Password string
	Host     string
	Port     string
	Database string
}

func MongoDBClientConfig

func MongoDBClientConfig() (mongoDBClientConfig *MongoDBClientConfigData, err error)

Retrieve configuration data (eg.host, port, etc.) from .env file for production settings only Base parameter for dependency injection of mongodb client (production)

func (*MongoDBClientConfigData) GetURI

func (mongoDBClientConfig *MongoDBClientConfigData) GetURI() (string, error)

GetURI returns the MongoDB connection URI based on the configuration.

type MongoDBMethodInterface

type MongoDBMethodInterface struct {
	MethodInterface MongoDBRepository
}

func NewMongoDBMethodInterface

func NewMongoDBMethodInterface(mongoClient *MongoDBClient) *MongoDBMethodInterface

type MongoDBRepository

type MongoDBRepository interface {
	CountDocumentsInMongo(databaseName string, collection string) (int, error)
	GetAllCollections(nameDatabase string) ([]string, error)
	FindDocumentsInMongo(databaseName string, collection string, interval int, skip int, result interface{}) error
}

/////////////////////////////////////////////////////////////////////////// Setup interface for database repository utilizing Dependency Injection ///////////////////

Jump to

Keyboard shortcuts

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