Documentation ¶
Index ¶
- type DBConfigService
- type DefaultDBConfigService
- func (d DefaultDBConfigService) ConnectDB() (*mongo.Client, error)
- func (d DefaultDBConfigService) CreateIndexesForCollection(db *mongo.Client, collectionName string, indexes ...mongo.IndexModel) error
- func (d DefaultDBConfigService) GetCollection(client *mongo.Client, collectionName string) *mongo.Collection
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 ¶
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
Click to show internal directories.
Click to hide internal directories.