Documentation ¶
Overview ¶
Package db implements database interactions.
Package db implements database interactions.
Package db implements database interactions.
Index ¶
Constants ¶
View Source
const (
// EnvDBTestURI holds test database URI. Needs to be in format: mongodb://user:password@address
EnvDBTestURI = "DBTEST_ISTADIFF"
)
Variables ¶
View Source
var ErrNoData = errors.New("no data in collection")
ErrNoData returned when no data found in collection.
Functions ¶
func BuildCollectionName ¶ added in v1.2.0
BuildCollectionName constructs collection name.
func SetUpMongoContainer ¶ added in v1.1.0
SetUpMongoContainer starts up mongoDB docker container and returns reset closure func, that should be run after m.Run().
Types ¶
type ContainerParams ¶ added in v1.1.0
ContainerParams holds mongo container parameters.
type DB ¶
type DB interface { // InsertUsersBatch creates record in database with passed users batch. InsertUsersBatch(ctx context.Context, users models.UsersBatch) error // GetLastUsersBatchByType returns last created users batch by passed batch type. GetLastUsersBatchByType(ctx context.Context, batchType models.UsersBatchType) (models.UsersBatch, error) // GetAllUsersBatchByType returns all users batches by passed batch type. GetAllUsersBatchByType(ctx context.Context, batchType models.UsersBatchType) ([]models.UsersBatch, error) }
DB represents database interaction contract.
type MongoParams ¶
MongoParams represents mongo db configuration parameters.
type Params ¶
type Params struct { LocalDB bool MongoParams MongoParams }
Params used for DB constructor.
Click to show internal directories.
Click to hide internal directories.