Documentation
¶
Index ¶
- func NewKafkaRepo(brokers []string, logger zerolog.Logger) repo.KafkaRepo
- func NewKafkaRepoWithConfig(brokers []string, logger zerolog.Logger, producerEnabled, consumerEnabled bool) repo.KafkaRepo
- func NewNatsRepo(nc *nats.NatsClient) repo.NatsRepo
- func ToShipperLocationEntity(model models.ShipperLocationModel) entity.ShipperLocation
- func ToShipperLocationModel(loc entity.ShipperLocation) models.ShipperLocationModel
- type KafkaRepo
- func (k *KafkaRepo) AddConsumer(topic, groupID string, ...) error
- func (k *KafkaRepo) Close() error
- func (k *KafkaRepo) DisableConsumer()
- func (k *KafkaRepo) DisableProducer()
- func (k *KafkaRepo) EnableConsumer()
- func (k *KafkaRepo) EnableProducer()
- func (k *KafkaRepo) GetStatus() map[string]interface{}
- func (k *KafkaRepo) IsConsumerEnabled() bool
- func (k *KafkaRepo) IsProducerEnabled() bool
- func (k *KafkaRepo) SendMessage(ctx context.Context, topic string, key []byte, value interface{}) error
- func (k *KafkaRepo) StartAllConsumers(ctx context.Context)
- func (k *KafkaRepo) StartConsumer(ctx context.Context, topic string) error
- type NatsRepo
- type PaymentRepo
- func (r *PaymentRepo) Create(ctx context.Context, payment *entity.Payment) error
- func (r *PaymentRepo) CreateHistory(ctx context.Context, payment *entity.Payment) error
- func (r *PaymentRepo) GetByID(ctx context.Context, id int64) (*entity.Payment, error)
- func (r *PaymentRepo) GetByUserID(ctx context.Context, userID int64) ([]*entity.Payment, error)
- func (r *PaymentRepo) UpdateStatus(ctx context.Context, id int64, status entity.PaymentStatus) error
- type RedisRepo
- func (r *RedisRepo) GetShipperLocation(ctx context.Context, shipperID string) (entity.ShipperLocation, error)
- func (r *RedisRepo) GetValue(ctx context.Context, key string) (entity.RedisValue, error)
- func (r *RedisRepo) SetShipperLocation(ctx context.Context, loc entity.ShipperLocation) error
- func (r *RedisRepo) SetValue(ctx context.Context, value entity.RedisValue) error
- type ShipperLocationRepo
- type TranslationRepo
- type UserRepo
- func (r *UserRepo) Create(ctx context.Context, user models.UserModel) (entity.User, error)
- func (r *UserRepo) Delete(ctx context.Context, id int64) error
- func (r *UserRepo) GetBuilder() squirrel.StatementBuilderType
- func (r *UserRepo) GetByEmail(ctx context.Context, email string) (entity.User, error)
- func (r *UserRepo) GetByID(ctx context.Context, id int64) (entity.User, error)
- func (r *UserRepo) GetPool() *pgxpool.Pool
- func (r *UserRepo) List(ctx context.Context) ([]entity.User, error)
- func (r *UserRepo) Update(ctx context.Context, user models.UserModel) error
- type VietQRRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKafkaRepo ¶
NewKafkaRepo -.
func NewKafkaRepoWithConfig ¶
func NewKafkaRepoWithConfig(brokers []string, logger zerolog.Logger, producerEnabled, consumerEnabled bool) repo.KafkaRepo
NewKafkaRepoWithConfig creates a new Kafka repository with configuration
func ToShipperLocationEntity ¶
func ToShipperLocationEntity(model models.ShipperLocationModel) entity.ShipperLocation
Convert models.ShipperLocationModel to entity.ShipperLocation
func ToShipperLocationModel ¶
func ToShipperLocationModel(loc entity.ShipperLocation) models.ShipperLocationModel
Convert entity.ShipperLocation to models.ShipperLocationModel
Types ¶
type KafkaRepo ¶
type KafkaRepo struct {
// contains filtered or unexported fields
}
KafkaRepo -.
func (*KafkaRepo) AddConsumer ¶
func (k *KafkaRepo) AddConsumer(topic, groupID string, handler func(ctx context.Context, key, value []byte) error) error
AddConsumer -.
func (*KafkaRepo) DisableConsumer ¶
func (k *KafkaRepo) DisableConsumer()
DisableConsumer disables the Kafka consumer
func (*KafkaRepo) DisableProducer ¶
func (k *KafkaRepo) DisableProducer()
DisableProducer disables the Kafka producer
func (*KafkaRepo) EnableConsumer ¶
func (k *KafkaRepo) EnableConsumer()
EnableConsumer enables the Kafka consumer
func (*KafkaRepo) EnableProducer ¶
func (k *KafkaRepo) EnableProducer()
EnableProducer enables the Kafka producer
func (*KafkaRepo) IsConsumerEnabled ¶
IsConsumerEnabled returns the current consumer status
func (*KafkaRepo) IsProducerEnabled ¶
IsProducerEnabled returns the current producer status
func (*KafkaRepo) SendMessage ¶
func (k *KafkaRepo) SendMessage(ctx context.Context, topic string, key []byte, value interface{}) error
SendMessage -.
func (*KafkaRepo) StartAllConsumers ¶
StartAllConsumers -.
type PaymentRepo ¶
PaymentRepo represents payment repository
func NewPaymentRepo ¶
func NewPaymentRepo(pg *postgres.Postgres) *PaymentRepo
NewPaymentRepo creates new payment repository
func (*PaymentRepo) CreateHistory ¶
CreateHistory creates payment history record
func (*PaymentRepo) GetByUserID ¶
GetByUserID gets payments by user ID
func (*PaymentRepo) UpdateStatus ¶
func (r *PaymentRepo) UpdateStatus(ctx context.Context, id int64, status entity.PaymentStatus) error
UpdateStatus updates payment status
type RedisRepo ¶
type RedisRepo struct {
// contains filtered or unexported fields
}
RedisRepo -.
func (*RedisRepo) GetShipperLocation ¶
func (r *RedisRepo) GetShipperLocation(ctx context.Context, shipperID string) (entity.ShipperLocation, error)
GetShipperLocation retrieves the latest shipper location from Redis.
func (*RedisRepo) SetShipperLocation ¶
SetShipperLocation stores the latest shipper location in Redis.
type ShipperLocationRepo ¶
type ShipperLocationRepo struct {
// contains filtered or unexported fields
}
func NewShipperLocationRepo ¶
func NewShipperLocationRepo(pg *postgres.Postgres) *ShipperLocationRepo
func (*ShipperLocationRepo) GetLatestByShipperID ¶
func (r *ShipperLocationRepo) GetLatestByShipperID(ctx context.Context, shipperID string) (entity.ShipperLocation, error)
GetLatestByShipperID retrieves the latest location for a shipper from the DB
func (*ShipperLocationRepo) Store ¶
func (r *ShipperLocationRepo) Store(ctx context.Context, loc entity.ShipperLocation) error
Store inserts a new shipper location record into the DB
type TranslationRepo ¶
TranslationRepo -.
func (*TranslationRepo) GetHistory ¶
func (r *TranslationRepo) GetHistory(ctx context.Context) ([]entity.Translation, error)
GetHistory -.
func (*TranslationRepo) Store ¶
func (r *TranslationRepo) Store(ctx context.Context, t models.TranslationModel) error
Store -.
type UserRepo ¶
UserRepo -.
func (*UserRepo) GetBuilder ¶
func (r *UserRepo) GetBuilder() squirrel.StatementBuilderType
GetBuilder returns the statement builder
func (*UserRepo) GetByEmail ¶
GetByEmail -.
type VietQRRepo ¶
type VietQRRepo struct {
// contains filtered or unexported fields
}
func NewVietQRRepo ¶
func NewVietQRRepo(pg *postgres.Postgres) *VietQRRepo
func (*VietQRRepo) UpdateStatus ¶
func (r *VietQRRepo) UpdateStatus(ctx context.Context, id string, status entity.VietQRStatus) error