repository

package
v0.0.0-...-9b54d0a Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 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 Auth

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

Auth - Auth

func NewAuth

func NewAuth(db *sqlx.DB) *Auth

NewAuth - constructor

func (*Auth) CreateUser

func (a *Auth) CreateUser(ctx context.Context, input domain.SignUpInput) error

CreateUser - create user

func (*Auth) GetByCredentials

func (a *Auth) GetByCredentials(ctx context.Context, email, password string) (domain.User, error)

GetByCredentials - get with credentials

type Authorizer

type Authorizer interface {
	CreateUser(ctx context.Context, input domain.SignUpInput) error
	GetByCredentials(ctx context.Context, email, password string) (domain.User, error)
}

Producter - auth contract

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

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