Documentation
¶
Overview ¶
Package usecase implements application business logic. Each logic group in own file.
Index ¶
- type Billing
- type Kafka
- type KafkaEventUseCase
- func (k *KafkaEventUseCase) ConsumeTranslationEvents(ctx context.Context) error
- func (k *KafkaEventUseCase) ConsumeUserEvents(ctx context.Context) error
- func (k *KafkaEventUseCase) ProduceTranslationEvent(ctx context.Context, eventType string, userID int64, ...) error
- func (k *KafkaEventUseCase) ProduceUserEvent(ctx context.Context, eventType string, userID int64, email string, data any) error
- type Nats
- type Redis
- type ShipperLocation
- type Translation
- type User
- type VietQR
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Billing ¶
type Billing interface {
GenerateInvoicePDF(data billing.InvoiceData, outputPath string) error
}
Billing -.
type Kafka ¶
type Kafka interface {
ProduceMessage(ctx context.Context, topic, key string, value interface{}) error
ConsumeMessage(ctx context.Context, topic, group string) (string, []byte, error)
// Control methods
EnableProducer()
DisableProducer()
IsProducerEnabled() bool
EnableConsumer()
DisableConsumer()
IsConsumerEnabled() bool
GetStatus() map[string]interface{}
}
func NewKafkaUseCase ¶
type KafkaEventUseCase ¶
type KafkaEventUseCase struct {
// contains filtered or unexported fields
}
KafkaEventUseCase -.
func NewKafkaEventUseCase ¶
func NewKafkaEventUseCase(kafkaRepo repo.KafkaRepo, logger zerolog.Logger) *KafkaEventUseCase
NewKafkaEventUseCase -.
func (*KafkaEventUseCase) ConsumeTranslationEvents ¶
func (k *KafkaEventUseCase) ConsumeTranslationEvents(ctx context.Context) error
ConsumeTranslationEvents -.
func (*KafkaEventUseCase) ConsumeUserEvents ¶
func (k *KafkaEventUseCase) ConsumeUserEvents(ctx context.Context) error
ConsumeUserEvents -.
func (*KafkaEventUseCase) ProduceTranslationEvent ¶
func (k *KafkaEventUseCase) ProduceTranslationEvent(ctx context.Context, eventType string, userID int64, source, target, original, translated string) error
ProduceTranslationEvent -.
func (*KafkaEventUseCase) ProduceUserEvent ¶
func (k *KafkaEventUseCase) ProduceUserEvent(ctx context.Context, eventType string, userID int64, email string, data any) error
ProduceUserEvent -.
type Nats ¶
type Nats interface {
Publish(subject string, data []byte) error
Subscribe(subject string, handler func(msg []byte)) (unsubscribe func() error, err error)
}
Nats -.
type Redis ¶
type Redis interface {
// SetValue sets a value in Redis
SetValue(ctx context.Context, value entity.RedisValue) error
// GetValue gets a value from Redis
GetValue(ctx context.Context, key string) (entity.RedisValue, error)
}
Redis -.
type ShipperLocation ¶
type ShipperLocation interface {
UpdateLocation(ctx context.Context, loc entity.ShipperLocation) error
GetLocation(ctx context.Context, shipperID string) (entity.ShipperLocation, error)
}
ShipperLocation -.
type Translation ¶
type Translation interface {
// Translate translates text from one language to another
Translate(ctx context.Context, t entity.Translation) (entity.Translation, error)
// History gets translation history
History(ctx context.Context) (entity.TranslationHistory, error)
}
Translation -.
type User ¶
type User interface {
// Create creates a new user
Create(ctx context.Context, user entity.User) (entity.User, error)
// GetByID gets user by ID
GetByID(ctx context.Context, id int64) (entity.User, error)
// Update updates user
Update(ctx context.Context, user entity.User) error
// Delete deletes user
Delete(ctx context.Context, id int64) error
// List gets all users
List(ctx context.Context) (entity.UserHistory, error)
// Login authenticates a user and returns a JWT token
Login(ctx context.Context, email, password string) (string, entity.User, error)
}
User -.
Click to show internal directories.
Click to hide internal directories.