db

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package db implements database interactions.

Package db implements database interactions.

Package db implements database interactions.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoData = errors.New("no data in collection")

ErrNoData returned when no data found in collection.

Functions

This section is empty.

Types

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)
}

DB represents database interaction contract.

func Connect

func Connect(params Params) (DB, error)

Connect returns specific database connection. MongoDB if mongo is enabled. LocalMemory in other case.

type MongoParams

type MongoParams struct {
	URL        string
	Database   string
	Collection string
}

MongoParams represents mongo db configuration parameters.

type Params

type Params struct {
	LocalDB     bool
	MongoParams MongoParams
}

Params used for DB constructor.

Jump to

Keyboard shortcuts

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