Documentation
¶
Index ¶
- Constants
- func InitDB(cfg *conf.Config) *sql.DB
- func NewDB(logger *log.Logger, cfg Config) (*sql.DB, error)
- type CartRepository
- func (c CartRepository) Create(cart *models.Cart) (*models.Cart, error)
- func (c CartRepository) CreateProduct(cart *models.Cart) (*models.Cart, error)
- func (c CartRepository) DeleteAllProductFromCart(userID int32) error
- func (c CartRepository) DeleteProductFromCart(userID int32, productID int) error
- func (c CartRepository) GetAllProductsFromCart(userID int32) (*[]models.Cart, error)
- func (c CartRepository) GetCart(userID int32) (int, error)
- func (c CartRepository) GetCartByUserID(userID int32) (*models.Cart, error)
- func (c CartRepository) GetCartProductsByID(cartID int) (cartProducts []models.CartProducts, err error)
- func (c CartRepository) Update(cart *models.Cart) (*models.Cart, error)
- type CartRepositoryI
- type Config
- type OrderRepository
- type OrderRepositoryI
- type ProductRepository
- func (p ProductRepository) Create(product *models.Product) (*models.Product, error)
- func (p ProductRepository) GetAll() (*[]models.Product, error)
- func (p ProductRepository) GetByID(id int) (*models.Product, error)
- func (p ProductRepository) GetByName(name string) (int32, error)
- func (p ProductRepository) GetTypes() (*[]models.ProductTypes, error)
- func (p ProductRepository) GetTypesBySupplier(supplierID int32) (*[]models.ProductTypes, error)
- func (p ProductRepository) Update(product *models.Product) (*models.Product, error)
- type ProductRepositoryI
- type SupplierRepository
- func (s SupplierRepository) Create(supplier *models.Supplier) (*models.Supplier, error)
- func (s SupplierRepository) DeleteUnnecessary(period int) error
- func (s SupplierRepository) GetAll() (*[]models.Supplier, error)
- func (s SupplierRepository) GetByName(name string) (int32, error)
- func (s SupplierRepository) GetTypes() (*[]models.SupplierTypes, error)
- func (s SupplierRepository) Update(supplier *models.Supplier) (*models.Supplier, error)
- type SupplierRepositoryI
- type SupplierRepositoryMock
- func (s SupplierRepositoryMock) Create(supplier *models.Supplier) (*models.Supplier, error)
- func (s SupplierRepositoryMock) DeleteUnnecessary(period int) error
- func (s SupplierRepositoryMock) GetAll() (*[]models.Supplier, error)
- func (s SupplierRepositoryMock) GetByID(id int) (*models.Supplier, error)
- func (s SupplierRepositoryMock) GetByName(name string) (int32, error)
- func (s SupplierRepositoryMock) Update(supplier *models.Supplier) (*models.Supplier, error)
- type TokensRepository
- func (u *TokensRepository) CreateUid(userID int32, uid models.CachedTokens) error
- func (u *TokensRepository) DeleteUid(userID int32) error
- func (u *TokensRepository) GetUidByID(claims *helper.JwtCustomClaims) (*models.CachedTokens, error)
- func (u *TokensRepository) UpdateUid(userID int32, uid models.CachedTokens) error
- type TokensRepositoryI
- type TokensRepositoryMock
- func (u *TokensRepositoryMock) CreateUid(userID int32, uid models.CachedTokens) error
- func (u *TokensRepositoryMock) DeleteUid(userID int32) error
- func (u *TokensRepositoryMock) GetUidByID(claims *helper.JwtCustomClaims) (*models.CachedTokens, error)
- func (u *TokensRepositoryMock) UpdateUid(userID int32, uid models.CachedTokens) error
- type UserRepository
- type UserRepositoryI
- type UserRepositoryMock
- func (u *UserRepositoryMock) Create(user *models.User) (*models.User, error)
- func (u *UserRepositoryMock) Delete(id int32) error
- func (u *UserRepositoryMock) EmailExist(email string) (int, error)
- func (u *UserRepositoryMock) GetAll() (*[]models.User, error)
- func (u *UserRepositoryMock) GetByEmail(email string) (*models.User, error)
- func (u *UserRepositoryMock) GetByID(id int32) (*models.User, error)
- func (u *UserRepositoryMock) Update(user *models.User) (*models.User, error)
Constants ¶
View Source
const ( UsersTable = "users" OrdersTable = "orders" OPTable = "order_products" SuppliersTable = "suppliers" ProductsTable = "products" CartTable = "cart" CartProductsTable = "cart_products" CacheTokenTable = "uid_token" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CartRepository ¶
type CartRepository struct {
// contains filtered or unexported fields
}
func NewCartRepository ¶
func NewCartRepository(db *sql.DB) *CartRepository
func (CartRepository) CreateProduct ¶
func (CartRepository) DeleteAllProductFromCart ¶
func (c CartRepository) DeleteAllProductFromCart(userID int32) error
func (CartRepository) DeleteProductFromCart ¶
func (c CartRepository) DeleteProductFromCart(userID int32, productID int) error
func (CartRepository) GetAllProductsFromCart ¶
func (c CartRepository) GetAllProductsFromCart(userID int32) (*[]models.Cart, error)
func (CartRepository) GetCartByUserID ¶
func (c CartRepository) GetCartByUserID(userID int32) (*models.Cart, error)
func (CartRepository) GetCartProductsByID ¶
func (c CartRepository) GetCartProductsByID(cartID int) (cartProducts []models.CartProducts, err error)
type CartRepositoryI ¶
type CartRepositoryI interface { Create(cart *models.Cart) (*models.Cart, error) CreateProduct(cart *models.Cart) (*models.Cart, error) GetCartByUserID(userID int32) (*models.Cart, error) GetCart(userID int32) (int, error) GetAllProductsFromCart(userID int32) (*[]models.Cart, error) GetCartProductsByID(id int) (cartProducts []models.CartProducts, err error) Update(cart *models.Cart) (*models.Cart, error) DeleteProductFromCart(userID int32, productID int) error DeleteAllProductFromCart(userID int32) error }
type OrderRepository ¶
type OrderRepository struct {
// contains filtered or unexported fields
}
func NewOrderRepository ¶
func NewOrderRepository(db *sql.DB) *OrderRepository
func (OrderRepository) GetAll ¶
func (o OrderRepository) GetAll(userID int32) (*[]models.Order, error)
func (OrderRepository) GetOrderProductsByID ¶
func (o OrderRepository) GetOrderProductsByID(id int32) (orderProducts []models.OrderProducts, err error)
type OrderRepositoryI ¶
type ProductRepository ¶
type ProductRepository struct {
// contains filtered or unexported fields
}
func NewProductRepository ¶
func NewProductRepository(db *sql.DB) *ProductRepository
func (ProductRepository) GetByID ¶
func (p ProductRepository) GetByID(id int) (*models.Product, error)
func (ProductRepository) GetByName ¶
func (p ProductRepository) GetByName(name string) (int32, error)
func (ProductRepository) GetTypes ¶
func (p ProductRepository) GetTypes() (*[]models.ProductTypes, error)
func (ProductRepository) GetTypesBySupplier ¶
func (p ProductRepository) GetTypesBySupplier(supplierID int32) (*[]models.ProductTypes, error)
type ProductRepositoryI ¶
type ProductRepositoryI interface { Create(product *models.Product) (*models.Product, error) GetAll() (*[]models.Product, error) GetTypes() (*[]models.ProductTypes, error) GetTypesBySupplier(supplierID int32) (*[]models.ProductTypes, error) GetByName(name string) (int32, error) Update(product *models.Product) (*models.Product, error) }
type SupplierRepository ¶
type SupplierRepository struct {
// contains filtered or unexported fields
}
func NewSupplierRepository ¶
func NewSupplierRepository(db *sql.DB) *SupplierRepository
func (SupplierRepository) DeleteUnnecessary ¶
func (s SupplierRepository) DeleteUnnecessary(period int) error
func (SupplierRepository) GetByName ¶
func (s SupplierRepository) GetByName(name string) (int32, error)
func (SupplierRepository) GetTypes ¶
func (s SupplierRepository) GetTypes() (*[]models.SupplierTypes, error)
type SupplierRepositoryI ¶
type SupplierRepositoryI interface { Create(supplier *models.Supplier) (*models.Supplier, error) GetAll() (*[]models.Supplier, error) GetByName(name string) (int32, error) GetTypes() (*[]models.SupplierTypes, error) Update(supplier *models.Supplier) (*models.Supplier, error) DeleteUnnecessary(period int) error }
type SupplierRepositoryMock ¶
type SupplierRepositoryMock struct {
// contains filtered or unexported fields
}
func NewSupplierRepositoryMock ¶
func NewSupplierRepositoryMock(db *sql.DB) *SupplierRepositoryMock
func (SupplierRepositoryMock) DeleteUnnecessary ¶
func (s SupplierRepositoryMock) DeleteUnnecessary(period int) error
func (SupplierRepositoryMock) GetAll ¶
func (s SupplierRepositoryMock) GetAll() (*[]models.Supplier, error)
func (SupplierRepositoryMock) GetByID ¶
func (s SupplierRepositoryMock) GetByID(id int) (*models.Supplier, error)
type TokensRepository ¶
type TokensRepository struct {
// contains filtered or unexported fields
}
func NewTokensRepository ¶
func NewTokensRepository(db *sql.DB) *TokensRepository
func (*TokensRepository) CreateUid ¶
func (u *TokensRepository) CreateUid(userID int32, uid models.CachedTokens) error
func (*TokensRepository) DeleteUid ¶
func (u *TokensRepository) DeleteUid(userID int32) error
func (*TokensRepository) GetUidByID ¶
func (u *TokensRepository) GetUidByID(claims *helper.JwtCustomClaims) (*models.CachedTokens, error)
func (*TokensRepository) UpdateUid ¶
func (u *TokensRepository) UpdateUid(userID int32, uid models.CachedTokens) error
type TokensRepositoryI ¶
type TokensRepositoryI interface { CreateUid(userID int32, uid models.CachedTokens) error GetUidByID(claims *helper.JwtCustomClaims) (*models.CachedTokens, error) UpdateUid(userID int32, uid models.CachedTokens) error DeleteUid(userID int32) error }
type TokensRepositoryMock ¶
type TokensRepositoryMock struct {
// contains filtered or unexported fields
}
func NewTokensRepositoryMock ¶
func NewTokensRepositoryMock(db *sql.DB) *TokensRepositoryMock
func (*TokensRepositoryMock) CreateUid ¶
func (u *TokensRepositoryMock) CreateUid(userID int32, uid models.CachedTokens) error
func (*TokensRepositoryMock) DeleteUid ¶
func (u *TokensRepositoryMock) DeleteUid(userID int32) error
func (*TokensRepositoryMock) GetUidByID ¶
func (u *TokensRepositoryMock) GetUidByID(claims *helper.JwtCustomClaims) (*models.CachedTokens, error)
func (*TokensRepositoryMock) UpdateUid ¶
func (u *TokensRepositoryMock) UpdateUid(userID int32, uid models.CachedTokens) error
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(db *sql.DB) *UserRepository
func (*UserRepository) EmailExist ¶
func (u *UserRepository) EmailExist(email string) (int, error)
func (*UserRepository) GetByEmail ¶
func (u *UserRepository) GetByEmail(email string) (*models.User, error)
type UserRepositoryI ¶
type UserRepositoryMock ¶
type UserRepositoryMock struct {
// contains filtered or unexported fields
}
func NewUserRepositoryMock ¶
func NewUserRepositoryMock(db *sql.DB) *UserRepositoryMock
func (*UserRepositoryMock) Delete ¶
func (u *UserRepositoryMock) Delete(id int32) error
func (*UserRepositoryMock) EmailExist ¶
func (u *UserRepositoryMock) EmailExist(email string) (int, error)
func (*UserRepositoryMock) GetByEmail ¶
func (u *UserRepositoryMock) GetByEmail(email string) (*models.User, error)
Click to show internal directories.
Click to hide internal directories.