data

package
v0.0.0-...-fa4078a Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Models

type Models struct {
	User    Users
	Product Products
}

func NewModels

func NewModels(db *sqlx.DB) *Models

type Products

type Products interface {
	Create(ctx context.Context, product *structure.Product) error
	GetByID(ctx context.Context, id int) (*structure.Product, error)
	GetAll(ctx context.Context) ([]structure.Product, error)
	UpdateByID(ctx context.Context, id int, product *structure.Product) error
	DeleteByID(ctx context.Context, id int) error
}

type ProductsTable

type ProductsTable struct {
	DB *sqlx.DB
}

func (*ProductsTable) Create

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

func (*ProductsTable) DeleteByID

func (p *ProductsTable) DeleteByID(ctx context.Context, id int) error

func (*ProductsTable) GetAll

func (p *ProductsTable) GetAll(ctx context.Context) ([]structure.Product, error)

func (*ProductsTable) GetByID

func (p *ProductsTable) GetByID(ctx context.Context, id int) (*structure.Product, error)

func (*ProductsTable) UpdateByID

func (p *ProductsTable) UpdateByID(ctx context.Context, id int, product *structure.Product) error

type Users

type Users interface {
	Create(ctx context.Context, user *structure.User) error
	GetByID(ctx context.Context, id int) (*structure.User, error)
	GetByUsername(ctx context.Context, username string) (*structure.User, error)
	GetAll(ctx context.Context, pagination *structure.GetAllUsersRequest) ([]structure.User, int, error)
	UpdateByID(ctx context.Context, id int, user *structure.User) error
	DeleteByID(ctx context.Context, id int) error
}

type UsersTable

type UsersTable struct {
	DB *sqlx.DB
}

func (*UsersTable) Create

func (u *UsersTable) Create(ctx context.Context, data *structure.User) error

func (*UsersTable) DeleteByID

func (u *UsersTable) DeleteByID(ctx context.Context, id int) error

func (*UsersTable) GetAll

func (u *UsersTable) GetAll(ctx context.Context, pagination *structure.GetAllUsersRequest) ([]structure.User, int, error)

func (*UsersTable) GetByID

func (u *UsersTable) GetByID(ctx context.Context, id int) (*structure.User, error)

func (*UsersTable) GetByUsername

func (u *UsersTable) GetByUsername(ctx context.Context, username string) (*structure.User, error)

func (*UsersTable) UpdateByID

func (u *UsersTable) UpdateByID(ctx context.Context, id int, user *structure.User) error

Jump to

Keyboard shortcuts

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