db

package
v0.0.0-...-e768eea Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QUERY_TIMEOUT = 5 * time.Second
	COLLECTION    = "users"
)
View Source
const (
	DB_TIMEOUT = 20 * time.Second
)

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(ctx context.Context, db *mongo.Database)

func InitDB

func InitDB(dbUri string) *mongo.Database

Types

type IUserStorage

type IUserStorage interface {
	Insert(context.Context, models.User) error
	GetAll(context.Context, models.GetUserQueryParams) ([]models.User, error)
	GetById(context.Context, string) (*models.User, error)
	Update(context.Context, models.User) error
	DeleteById(context.Context, string) error
}

DB CRUD opertions for the 'users' collection

func NewStorage

func NewStorage(database *mongo.Database) IUserStorage

Jump to

Keyboard shortcuts

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