repository

package
v0.0.0-...-dbfc5a5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSqlite3DB

func NewSqlite3DB(cfg Config) (*sqlx.DB, error)

NewSqlite3DB - open connect and ping trying

Types

type Config

type Config struct {
	Driver string
}

Config - db

type Product

type Product struct {
	// contains filtered or unexported fields
}

Product - product

func NewProduct

func NewProduct(db *sqlx.DB) *Product

NewProduct - constructor

func (*Product) Create

func (p *Product) Create(ctx context.Context, product domain.Product) error

Create - create product

func (*Product) DeleteById

func (p *Product) DeleteById(ctx context.Context, id int) error

DeleteById - delete product

func (*Product) GetAllProducts

func (p *Product) GetAllProducts(ctx context.Context) ([]domain.Product, error)

GetAllProducts - getting all products in csv-file

func (*Product) UpdateById

func (p *Product) UpdateById(ctx context.Context, id int, input domain.UpdateProductInput) error

UpdateById - update product

type Producter

type Producter interface {
	Create(ctx context.Context, product domain.Product) error
	UpdateById(ctx context.Context, id int, input domain.UpdateProductInput) error
	DeleteById(ctx context.Context, id int) error
	GetAllProducts(ctx context.Context) ([]domain.Product, error)
}

Producter - repository contract

type Repository

type Repository struct {
	Producter
}

Repository - repo

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

NewRepository - constructor

Jump to

Keyboard shortcuts

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