usecase

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: 9 Imported by: 0

Documentation

Overview

Package usecase implements application business logic. Each logic group in own file.

Index

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

func NewKafkaUseCase(kafkaRepo repo.KafkaRepo) Kafka

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 -.

type VietQR

type VietQR interface {
	GenerateQR(ctx context.Context, req entity.VietQRGenerateRequest) (*entity.VietQR, error)
	InquiryQR(ctx context.Context, id string) (*entity.VietQR, error)
	UpdateStatus(ctx context.Context, id string, status entity.VietQRStatus) error
}

VietQR -.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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