Documentation
¶
Overview ¶
internal/repository/postgres/price_history.go
Index ¶
- Constants
- func NewAdvertRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.AdvertRepository, error)
- func NewCartRepository(db *pgxpool.Pool, ctx context.Context) (repository.Cart, error)
- func NewCategoryRepository(db *pgxpool.Pool, logger *zap.Logger, ctx context.Context, ...) (repository.CategoryRepository, error)
- func NewPaymentRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.PaymentRepository, error)
- func NewPromotionRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.PromotionRepository, error)
- func NewPurchaseRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.PurchaseRepository, error)
- func NewSellerRepository(db *pgxpool.Pool, ctx context.Context) (repository.Seller, error)
- func NewStaticRepository(ctx context.Context, dbpool *pgxpool.Pool, basicPath string, maxSize int, ...) (repository.StaticRepository, error)
- func NewUserRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.User, error)
- type AdvertDB
- func (r *AdvertDB) Add(a *entity.Advert) (*entity.Advert, error)
- func (r *AdvertDB) AddToSaved(advertId, userId uuid.UUID) error
- func (r *AdvertDB) AddViewed(userId, advertId uuid.UUID) error
- func (r *AdvertDB) BeginTransaction() (pgx.Tx, error)
- func (r *AdvertDB) CheckIfExists(advertId uuid.UUID) (bool, error)
- func (r *AdvertDB) Count() (int, error)
- func (r *AdvertDB) DeleteById(advertId uuid.UUID) error
- func (r *AdvertDB) DeleteFromSaved(userId uuid.UUID, advertId uuid.UUID) error
- func (r *AdvertDB) Get(limit, offset int, userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) GetByCartId(cartId, userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) GetByCategoryId(categoryId, userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) GetById(advertId, userId uuid.UUID) (*entity.Advert, error)
- func (r *AdvertDB) GetBySellerId(sellerId, userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) GetByUserId(sellerId, userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) GetSavedByUserId(userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) PromoteAdvert(advertID uuid.UUID) (*entity.Advert, error)
- func (r *AdvertDB) Search(query string, limit, offset int, userId uuid.UUID) ([]*entity.Advert, error)
- func (r *AdvertDB) Update(advert *entity.Advert) error
- func (r *AdvertDB) UpdateStatus(tx pgx.Tx, advertId uuid.UUID, status entity.AdvertStatus) error
- func (r *AdvertDB) UploadImage(advertId uuid.UUID, imageId uuid.UUID) error
- type AdvertRepoModel
- type CartDB
- func (c *CartDB) AddAdvert(cartID uuid.UUID, AdvertID uuid.UUID) error
- func (c *CartDB) Create(userID uuid.UUID) (uuid.UUID, error)
- func (c *CartDB) DeleteAdvert(cartID uuid.UUID, AdvertID uuid.UUID) error
- func (c *CartDB) GetAdvertsByCartId(cartID uuid.UUID) ([]entity.Advert, error)
- func (c *CartDB) GetById(cartID uuid.UUID) (entity.Cart, error)
- func (c *CartDB) GetByUserId(userID uuid.UUID) (entity.Cart, error)
- func (c *CartDB) UpdateStatus(tx pgx.Tx, cartID uuid.UUID, status entity.CartStatus) error
- type CategoryDB
- type DBExecutor
- type DBSeller
- type DBUser
- type PaymentDB
- func (r *PaymentDB) GetOrderByID(orderID string) (*entity.Order, error)
- func (r *PaymentDB) GetOrdersInProcess() ([]entity.Order, error)
- func (r *PaymentDB) InsertOrder(orderID, amount, paymentID, status string) (*entity.Order, error)
- func (r *PaymentDB) UpdateOrderStatus(orderID string, status string) (*entity.Order, error)
- type PgxConnIface
- type PgxPoolIface
- type PriceHistoryDB
- type PromotionDB
- type PurchaseDB
- type SavedAdvertRepoModel
- type SellerDB
- type StaticDB
- type UserDB
- func (us *UserDB) Add(tx pgx.Tx, email string, hash, salt []byte) (uuid.UUID, error)
- func (us *UserDB) BeginTransaction() (pgx.Tx, error)
- func (us *UserDB) CheckIfExists(userId uuid.UUID) (bool, error)
- func (us *UserDB) Delete(userID uuid.UUID) error
- func (us *UserDB) GetByEmail(email string) (*entity.User, error)
- func (us *UserDB) GetById(id uuid.UUID) (*entity.User, error)
- func (us *UserDB) Update(user *entity.User) error
- func (us *UserDB) UploadImage(userID uuid.UUID, imageId uuid.UUID) error
Constants ¶
View Source
const ( OrderStatusInProcess = "in_process" OrderStatusCanceled = "canceled" OrderStatusCompleted = "completed" )
Variables ¶
This section is empty.
Functions ¶
func NewAdvertRepository ¶
func NewAdvertRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.AdvertRepository, error)
func NewCartRepository ¶
func NewCategoryRepository ¶
func NewPaymentRepository ¶
func NewPaymentRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.PaymentRepository, error)
func NewPromotionRepository ¶
func NewPromotionRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.PromotionRepository, error)
func NewPurchaseRepository ¶
func NewPurchaseRepository(db *pgxpool.Pool, ctx context.Context, timeout time.Duration) (repository.PurchaseRepository, error)
func NewSellerRepository ¶
func NewStaticRepository ¶
Types ¶
type AdvertDB ¶
type AdvertDB struct { DB DBExecutor // contains filtered or unexported fields }
func (*AdvertDB) BeginTransaction ¶
func (*AdvertDB) DeleteFromSaved ¶
func (*AdvertDB) GetByCartId ¶
func (*AdvertDB) GetByCategoryId ¶
func (*AdvertDB) GetBySellerId ¶
func (*AdvertDB) GetByUserId ¶
func (*AdvertDB) GetSavedByUserId ¶
func (*AdvertDB) PromoteAdvert ¶
func (*AdvertDB) UpdateStatus ¶
type AdvertRepoModel ¶
type CartDB ¶
type CartDB struct { DB DBExecutor // contains filtered or unexported fields }
func (*CartDB) DeleteAdvert ¶
func (*CartDB) GetAdvertsByCartId ¶
func (*CartDB) UpdateStatus ¶
type CategoryDB ¶
type CategoryDB struct { DB DBExecutor // contains filtered or unexported fields }
type DBExecutor ¶
type DBExecutor interface { QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) Begin(ctx context.Context) (pgx.Tx, error) }
type DBSeller ¶
type DBUser ¶
type PaymentDB ¶
type PaymentDB struct { DB DBExecutor // contains filtered or unexported fields }
func (*PaymentDB) GetOrderByID ¶
func (*PaymentDB) GetOrdersInProcess ¶
func (*PaymentDB) InsertOrder ¶
type PgxConnIface ¶
type PgxConnIface interface { pgx.Conn }
type PgxPoolIface ¶
type PriceHistoryDB ¶
type PriceHistoryDB struct {
// contains filtered or unexported fields
}
func NewHistoryRepository ¶
func (*PriceHistoryDB) AddAdvertPriceChange ¶
func (p *PriceHistoryDB) AddAdvertPriceChange(advertID uuid.UUID, oldPrice, newPrice int) error
func (*PriceHistoryDB) GetAdvertPriceHistory ¶
func (p *PriceHistoryDB) GetAdvertPriceHistory(advertID uuid.UUID) ([]*entity.PriceHistory, error)
type PromotionDB ¶
type PromotionDB struct {
// contains filtered or unexported fields
}
func (*PromotionDB) GetPromotionInfo ¶
func (r *PromotionDB) GetPromotionInfo() (*entity.Promotion, error)
type PurchaseDB ¶
type PurchaseDB struct {
// contains filtered or unexported fields
}
func (*PurchaseDB) BeginTransaction ¶
func (c *PurchaseDB) BeginTransaction() (pgx.Tx, error)
func (*PurchaseDB) GetByUserId ¶
type SavedAdvertRepoModel ¶
type SellerDB ¶
type SellerDB struct { DB DBExecutor // contains filtered or unexported fields }
type StaticDB ¶
type StaticDB struct { DB DBExecutor BasicPath string MaxSize int Ctx context.Context // contains filtered or unexported fields }
func (StaticDB) GetMaxSize ¶
type UserDB ¶
type UserDB struct { DB DBExecutor // contains filtered or unexported fields }
func (*UserDB) BeginTransaction ¶
Click to show internal directories.
Click to hide internal directories.