db

package
v0.0.0-...-7af1892 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	CategoryRepo repository.CategoryRepo
	ProductRepo  repository.ProductRepo
	// contains filtered or unexported fields
}

func InitializeDatabase

func InitializeDatabase(
	ctx context.Context,
	timeout time.Duration,
	host, port, dbName string,
) (*Database, error)

func (*Database) CloseConnection

func (d *Database) CloseConnection(ctx context.Context) error

func (*Database) GetCollectionHandler

func (d *Database) GetCollectionHandler(collectonName string) *mongo.Collection

func (*Database) SetRepo

func (d *Database) SetRepo(opts ...RepoOpts)

func (*Database) TestConnection

func (d *Database) TestConnection(ctx context.Context, timeout time.Duration) error

type RepoOpts

type RepoOpts func(d *Database)

func SetCategoryRepo

func SetCategoryRepo(c repository.CategoryRepo) RepoOpts

func SetProductRepo

func SetProductRepo(p repository.ProductRepo) RepoOpts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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