persistent

package
v0.0.0-...-19dc864 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKafkaRepo

func NewKafkaRepo(brokers []string, logger zerolog.Logger) repo.KafkaRepo

NewKafkaRepo -.

func NewKafkaRepoWithConfig

func NewKafkaRepoWithConfig(brokers []string, logger zerolog.Logger, producerEnabled, consumerEnabled bool) repo.KafkaRepo

NewKafkaRepoWithConfig creates a new Kafka repository with configuration

func NewNatsRepo

func NewNatsRepo(nc *nats.NatsClient) repo.NatsRepo

NewNatsRepo -.

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) Close

func (k *KafkaRepo) Close() error

Close -.

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) GetStatus

func (k *KafkaRepo) GetStatus() map[string]interface{}

GetStatus returns the current status of both producer and consumer

func (*KafkaRepo) IsConsumerEnabled

func (k *KafkaRepo) IsConsumerEnabled() bool

IsConsumerEnabled returns the current consumer status

func (*KafkaRepo) IsProducerEnabled

func (k *KafkaRepo) IsProducerEnabled() bool

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

func (k *KafkaRepo) StartAllConsumers(ctx context.Context)

StartAllConsumers -.

func (*KafkaRepo) StartConsumer

func (k *KafkaRepo) StartConsumer(ctx context.Context, topic string) error

StartConsumer -.

type NatsRepo

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

NatsRepo -.

func (*NatsRepo) Publish

func (r *NatsRepo) Publish(subject string, data []byte) error

Publish -.

func (*NatsRepo) Subscribe

func (r *NatsRepo) Subscribe(subject string, handler func(msg []byte)) (func() error, error)

Subscribe -.

type PaymentRepo

type PaymentRepo struct {
	*postgres.Postgres
}

PaymentRepo represents payment repository

func NewPaymentRepo

func NewPaymentRepo(pg *postgres.Postgres) *PaymentRepo

NewPaymentRepo creates new payment repository

func (*PaymentRepo) Create

func (r *PaymentRepo) Create(ctx context.Context, payment *entity.Payment) error

Create creates new payment

func (*PaymentRepo) CreateHistory

func (r *PaymentRepo) CreateHistory(ctx context.Context, payment *entity.Payment) error

CreateHistory creates payment history record

func (*PaymentRepo) GetByID

func (r *PaymentRepo) GetByID(ctx context.Context, id int64) (*entity.Payment, error)

GetByID gets payment by ID

func (*PaymentRepo) GetByUserID

func (r *PaymentRepo) GetByUserID(ctx context.Context, userID int64) ([]*entity.Payment, error)

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 NewRedisRepo

func NewRedisRepo(r *redis.Redis) *RedisRepo

NewRedisRepo -.

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) GetValue

func (r *RedisRepo) GetValue(ctx context.Context, key string) (entity.RedisValue, error)

GetValue -.

func (*RedisRepo) SetShipperLocation

func (r *RedisRepo) SetShipperLocation(ctx context.Context, loc entity.ShipperLocation) error

SetShipperLocation stores the latest shipper location in Redis.

func (*RedisRepo) SetValue

func (r *RedisRepo) SetValue(ctx context.Context, value entity.RedisValue) error

SetValue -.

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

Store inserts a new shipper location record into the DB

type TranslationRepo

type TranslationRepo struct {
	*postgres.Postgres
}

TranslationRepo -.

func New

New -.

func (*TranslationRepo) GetHistory

func (r *TranslationRepo) GetHistory(ctx context.Context) ([]entity.Translation, error)

GetHistory -.

func (*TranslationRepo) Store

Store -.

type UserRepo

type UserRepo struct {
	*postgres.Postgres
}

UserRepo -.

func NewUserRepo

func NewUserRepo(pg *postgres.Postgres) *UserRepo

NewUserRepo -.

func (*UserRepo) Create

func (r *UserRepo) Create(ctx context.Context, user models.UserModel) (entity.User, error)

Create -.

func (*UserRepo) Delete

func (r *UserRepo) Delete(ctx context.Context, id int64) error

Delete -.

func (*UserRepo) GetBuilder

func (r *UserRepo) GetBuilder() squirrel.StatementBuilderType

GetBuilder returns the statement builder

func (*UserRepo) GetByEmail

func (r *UserRepo) GetByEmail(ctx context.Context, email string) (entity.User, error)

GetByEmail -.

func (*UserRepo) GetByID

func (r *UserRepo) GetByID(ctx context.Context, id int64) (entity.User, error)

GetByID -.

func (*UserRepo) GetPool

func (r *UserRepo) GetPool() *pgxpool.Pool

GetPool returns the database pool

func (*UserRepo) List

func (r *UserRepo) List(ctx context.Context) ([]entity.User, error)

List -.

func (*UserRepo) Update

func (r *UserRepo) Update(ctx context.Context, user models.UserModel) error

Update -.

type VietQRRepo

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

func NewVietQRRepo

func NewVietQRRepo(pg *postgres.Postgres) *VietQRRepo

func (*VietQRRepo) FindByID

func (r *VietQRRepo) FindByID(ctx context.Context, id string) (entity.VietQR, error)

func (*VietQRRepo) Store

func (r *VietQRRepo) Store(ctx context.Context, qr entity.VietQR) error

func (*VietQRRepo) UpdateStatus

func (r *VietQRRepo) UpdateStatus(ctx context.Context, id string, status entity.VietQRStatus) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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