configuration

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConfigService

type DBConfigService interface {
	ConnectDB(mongoURI string) (*mongo.Client, error)
	GetCollection(client *mongo.Client, collectionName string) *mongo.Collection
	CreateIndexes(db *mongo.Client) error
}

DBConfigService configuration interface for

type DefaultDBConfigService

type DefaultDBConfigService struct {
	MongoURI     string
	DatabaseName string
}

DefaultDBConfigService a default bare-bones configuration service. You can pass your own implementation

func (DefaultDBConfigService) ConnectDB

func (d DefaultDBConfigService) ConnectDB() (*mongo.Client, error)

ConnectDB connect to database returns an error if the operation fails

func (DefaultDBConfigService) CreateIndexesForCollection

func (d DefaultDBConfigService) CreateIndexesForCollection(db *mongo.Client, collectionName string, indexes ...mongo.IndexModel) error

CreateIndexesForCollection create indexes for your collection

func (DefaultDBConfigService) GetCollection

func (d DefaultDBConfigService) GetCollection(client *mongo.Client, collectionName string) *mongo.Collection

GetCollection get a mongo collection by collection name

Jump to

Keyboard shortcuts

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