repository

package
v0.0.0-...-aeadd1c Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryRepository

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

*

  • CategoryRepository implements port.CategoryRepository interface
  • and provides an access to the postgres database

func NewCategoryRepository

func NewCategoryRepository(db *postgres.DB) *CategoryRepository

NewCategoryRepository creates a new category repository instance

func (*CategoryRepository) CreateCategory

func (cr *CategoryRepository) CreateCategory(ctx context.Context, category *domain.Category) (*domain.Category, error)

CreateCategory creates a new category record in the database

func (*CategoryRepository) DeleteCategory

func (cr *CategoryRepository) DeleteCategory(ctx context.Context, id uint64) error

DeleteCategory deletes a category record from the database by id

func (*CategoryRepository) GetCategoryByID

func (cr *CategoryRepository) GetCategoryByID(ctx context.Context, id uint64) (*domain.Category, error)

GetCategoryByID retrieves a category record from the database by id

func (*CategoryRepository) ListCategories

func (cr *CategoryRepository) ListCategories(ctx context.Context, skip, limit uint64) ([]domain.Category, error)

ListCategories retrieves a list of categories from the database

func (*CategoryRepository) UpdateCategory

func (cr *CategoryRepository) UpdateCategory(ctx context.Context, category *domain.Category) (*domain.Category, error)

UpdateCategory updates a category record in the database

type OrderRepository

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

*

  • OrderRepository implements port.OrderRepository interface
  • and provides an access to the postgres database

func NewOrderRepository

func NewOrderRepository(db *postgres.DB) *OrderRepository

NewOrderRepository creates a new order repository instance

func (*OrderRepository) CreateOrder

func (or *OrderRepository) CreateOrder(ctx context.Context, order *domain.Order) (*domain.Order, error)

CreateOrder creates a new order in the database

func (*OrderRepository) GetOrderByID

func (or *OrderRepository) GetOrderByID(ctx context.Context, id uint64) (*domain.Order, error)

GetOrderByID gets an order by ID from the database

func (*OrderRepository) ListOrders

func (or *OrderRepository) ListOrders(ctx context.Context, skip, limit uint64) ([]domain.Order, error)

ListOrders lists all orders from the database

type PaymentRepository

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

*

  • PaymentRepository implements port.PaymentRepository interface
  • and provides an access to the postgres database

func NewPaymentRepository

func NewPaymentRepository(db *postgres.DB) *PaymentRepository

NewPaymentRepository creates a new payment repository instance

func (*PaymentRepository) CreatePayment

func (pr *PaymentRepository) CreatePayment(ctx context.Context, payment *domain.Payment) (*domain.Payment, error)

CreatePayment creates a new payment record in the database

func (*PaymentRepository) DeletePayment

func (pr *PaymentRepository) DeletePayment(ctx context.Context, id uint64) error

DeletePayment deletes a payment record from the database by id

func (*PaymentRepository) GetPaymentByID

func (pr *PaymentRepository) GetPaymentByID(ctx context.Context, id uint64) (*domain.Payment, error)

GetPaymentByID retrieves a payment record from the database by id

func (*PaymentRepository) ListPayments

func (pr *PaymentRepository) ListPayments(ctx context.Context, skip, limit uint64) ([]domain.Payment, error)

ListPayments retrieves a list of payments from the database

func (*PaymentRepository) UpdatePayment

func (pr *PaymentRepository) UpdatePayment(ctx context.Context, payment *domain.Payment) (*domain.Payment, error)

UpdatePayment updates a payment record in the database

type ProductRepository

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

*

  • ProductRepository implements port.ProductRepository interface
  • and provides an access to the postgres database

func NewProductRepository

func NewProductRepository(db *postgres.DB) *ProductRepository

NewProductRepository creates a new product repository instance

func (*ProductRepository) CreateProduct

func (pr *ProductRepository) CreateProduct(ctx context.Context, product *domain.Product) (*domain.Product, error)

CreateProduct creates a new product record in the database

func (*ProductRepository) DeleteProduct

func (pr *ProductRepository) DeleteProduct(ctx context.Context, id uint64) error

DeleteProduct deletes a product record from the database by id

func (*ProductRepository) GetProductByID

func (pr *ProductRepository) GetProductByID(ctx context.Context, id uint64) (*domain.Product, error)

GetProductByID retrieves a product record from the database by id

func (*ProductRepository) ListProducts

func (pr *ProductRepository) ListProducts(ctx context.Context, search string, categoryId, skip, limit uint64) ([]domain.Product, error)

ListProducts retrieves a list of products from the database

func (*ProductRepository) UpdateProduct

func (pr *ProductRepository) UpdateProduct(ctx context.Context, product *domain.Product) (*domain.Product, error)

UpdateProduct updates a product record in the database

type UserRepository

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

*

  • UserRepository implements port.UserRepository interface
  • and provides an access to the postgres database

func NewUserRepository

func NewUserRepository(db *postgres.DB) *UserRepository

NewUserRepository creates a new user repository instance

func (*UserRepository) CreateUser

func (ur *UserRepository) CreateUser(ctx context.Context, user *domain.User) (*domain.User, error)

CreateUser creates a new user in the database

func (*UserRepository) DeleteUser

func (ur *UserRepository) DeleteUser(ctx context.Context, id uint64) error

DeleteUser deletes a user by ID from the database

func (*UserRepository) GetUserByEmail

func (ur *UserRepository) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)

GetUserByEmailAndPassword gets a user by email from the database

func (*UserRepository) GetUserByID

func (ur *UserRepository) GetUserByID(ctx context.Context, id uint64) (*domain.User, error)

GetUserByID gets a user by ID from the database

func (*UserRepository) ListUsers

func (ur *UserRepository) ListUsers(ctx context.Context, skip, limit uint64) ([]domain.User, error)

ListUsers lists all users from the database

func (*UserRepository) UpdateUser

func (ur *UserRepository) UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error)

UpdateUser updates a user by ID in the database

Jump to

Keyboard shortcuts

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