Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface {
// Login authenticates a user by email and password and returns a token
Login(ctx context.Context, email, password string) (string, error)
}
UserService is an interface for interacting with user authentication-related business logic
type CacheRepository ¶
type CacheRepository interface {
// Set stores the value in the cache
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
// Get retrieves the value from the cache
Get(ctx context.Context, key string) ([]byte, error)
// Delete removes the value from the cache
Delete(ctx context.Context, key string) error
// DeleteByPrefix removes the value from the cache with the given prefix
DeleteByPrefix(ctx context.Context, prefix string) error
// Close closes the connection to the cache server
Close() error
}
CacheRepository is an interface for interacting with cache-related business logic
type CategoryRepository ¶
type CategoryRepository interface {
// CreateCategory inserts a new category into the database
CreateCategory(ctx context.Context, category *domaincategory.Category) (*domaincategory.Category, error)
// GetCategoryByID selects a category by id
GetCategoryByID(ctx context.Context, id uint64) (*domaincategory.Category, error)
// ListCategories selects a list of categories with pagination
ListCategories(ctx context.Context, skip, limit uint64) ([]domaincategory.Category, error)
// UpdateCategory updates a category
UpdateCategory(ctx context.Context, category *domaincategory.Category) (*domaincategory.Category, error)
// DeleteCategory deletes a category
DeleteCategory(ctx context.Context, id uint64) error
}
CategoryRepository is an interface for interacting with category-related data
type CategoryService ¶
type CategoryService interface {
// CreateCategory creates a new category
CreateCategory(ctx context.Context, category *domaincategory.Category) (*domaincategory.Category, error)
// GetCategory returns a category by id
GetCategory(ctx context.Context, id uint64) (*domaincategory.Category, error)
// ListCategories returns a list of categories with pagination
ListCategories(ctx context.Context, skip, limit uint64) ([]domaincategory.Category, error)
// UpdateCategory updates a category
UpdateCategory(ctx context.Context, category *domaincategory.Category) (*domaincategory.Category, error)
// DeleteCategory deletes a category
DeleteCategory(ctx context.Context, id uint64) error
}
CategoryService is an interface for interacting with category-related business logic
type OrderRepository ¶
type OrderRepository interface {
// CreateOrder inserts a new order into the database
CreateOrder(ctx context.Context, order *domainorder.Order) (*domainorder.Order, error)
// GetOrderByID selects an order by id
GetOrderByID(ctx context.Context, id uint64) (*domainorder.Order, error)
// ListOrders selects a list of orders with pagination
ListOrders(ctx context.Context, skip, limit uint64) ([]domainorder.Order, error)
}
OrderRepository is an interface for interacting with order-related data
type OrderService ¶
type OrderService interface {
// CreateOrder creates a new order
CreateOrder(ctx context.Context, order *domainorder.Order) (*domainorder.Order, error)
// GetOrder returns an order by id
GetOrder(ctx context.Context, id uint64) (*domainorder.Order, error)
// ListOrders returns a list of orders with pagination
ListOrders(ctx context.Context, skip, limit uint64) ([]domainorder.Order, error)
}
OrderService is an interface for interacting with order-related business logic
type PaymentRepository ¶
type PaymentRepository interface {
// CreatePayment inserts a new payment into the database
CreatePayment(ctx context.Context, payment *domainpayment.Payment) (*domainpayment.Payment, error)
// GetPaymentByID selects a payment by id
GetPaymentByID(ctx context.Context, id uint64) (*domainpayment.Payment, error)
// ListPayments selects a list of payments with pagination
ListPayments(ctx context.Context, skip, limit uint64) ([]domainpayment.Payment, error)
// UpdatePayment updates a payment
UpdatePayment(ctx context.Context, payment *domainpayment.Payment) (*domainpayment.Payment, error)
// DeletePayment deletes a payment
DeletePayment(ctx context.Context, id uint64) error
}
PaymentRepository is an interface for interacting with payment-related data
type PaymentService ¶
type PaymentService interface {
// CreatePayment creates a new payment
CreatePayment(ctx context.Context, payment *domainpayment.Payment) (*domainpayment.Payment, error)
// GetPayment returns a payment by id
GetPayment(ctx context.Context, id uint64) (*domainpayment.Payment, error)
// ListPayments returns a list of payments with pagination
ListPayments(ctx context.Context, skip, limit uint64) ([]domainpayment.Payment, error)
// UpdatePayment updates a payment
UpdatePayment(ctx context.Context, payment *domainpayment.Payment) (*domainpayment.Payment, error)
// DeletePayment deletes a payment
DeletePayment(ctx context.Context, id uint64) error
}
PaymentService is an interface for interacting with payment-related business logic
type ProductRepository ¶
type ProductRepository interface {
// CreateProduct inserts a new product into the database
CreateProduct(ctx context.Context, product *domainproduct.Product) (*domainproduct.Product, error)
// GetProductByID selects a product by id
GetProductByID(ctx context.Context, id uint64) (*domainproduct.Product, error)
// ListProducts selects a list of products with pagination
ListProducts(ctx context.Context, search string, categoryId, skip, limit uint64) ([]domainproduct.Product, error)
// UpdateProduct updates a product
UpdateProduct(ctx context.Context, product *domainproduct.Product) (*domainproduct.Product, error)
// DeleteProduct deletes a product
DeleteProduct(ctx context.Context, id uint64) error
}
ProductRepository is an interface for interacting with product-related data
type ProductService ¶
type ProductService interface {
// CreateProduct creates a new product
CreateProduct(ctx context.Context, product *domainproduct.Product) (*domainproduct.Product, error)
// GetProduct returns a product by id
GetProduct(ctx context.Context, id uint64) (*domainproduct.Product, error)
// ListProducts returns a list of products with pagination
ListProducts(ctx context.Context, search string, categoryId, skip, limit uint64) ([]domainproduct.Product, error)
// UpdateProduct updates a product
UpdateProduct(ctx context.Context, product *domainproduct.Product) (*domainproduct.Product, error)
// DeleteProduct deletes a product
DeleteProduct(ctx context.Context, id uint64) error
}
ProductService is an interface for interacting with product-related business logic
type TokenService ¶
type TokenService interface {
// CreateToken creates a new token for a given user
CreateToken(user *domainuser.User) (string, error)
// VerifyToken verifies the token and returns the payload
VerifyToken(token string) (*domainauth.TokenPayload, error)
}
TokenService is an interface for interacting with token-related business logic
type UserRepository ¶
type UserRepository interface {
// CreateUser inserts a new user into the database
CreateUser(ctx context.Context, user *domainuser.User) (*domainuser.User, error)
// GetUserByID selects a user by id
GetUserByID(ctx context.Context, id uint64) (*domainuser.User, error)
// GetUserByEmail selects a user by email
GetUserByEmail(ctx context.Context, email string) (*domainuser.User, error)
// ListUsers selects a list of users with pagination
ListUsers(ctx context.Context, skip, limit uint64) ([]domainuser.User, error)
// UpdateUser updates a user
UpdateUser(ctx context.Context, user *domainuser.User) (*domainuser.User, error)
// DeleteUser deletes a user
DeleteUser(ctx context.Context, id uint64) error
}
UserRepository is an interface for interacting with user-related data
type UserService ¶
type UserService interface {
// Register registers a new user
Register(ctx context.Context, user *domainuser.User) (*domainuser.User, error)
// GetUser returns a user by id
GetUser(ctx context.Context, id uint64) (*domainuser.User, error)
// ListUsers returns a list of users with pagination
ListUsers(ctx context.Context, skip, limit uint64) ([]domainuser.User, error)
// UpdateUser updates a user
UpdateUser(ctx context.Context, user *domainuser.User) (*domainuser.User, error)
// DeleteUser deletes a user
DeleteUser(ctx context.Context, id uint64) error
}
UserService is an interface for interacting with user-related business logic