trxhistory

package
v0.0.0-...-ac819ea Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValidation         = fmt.Errorf("validation error")
	ErrDBPersist          = fmt.Errorf("persist to database error")
	ErrTrxHistoryNotFound = fmt.Errorf("transaction history not found in database")
)

--- list of error and constants

Functions

func RegisterHandlers

func RegisterHandlers(r *routing.RouteGroup, service Service, authHandler routing.Handler, logger log.Logger)

RegisterHandlers sets up the routing of the HTTP handlers.

Types

type CacheRepository

type CacheRepository interface {
	GetByIdFromRedis(id int) (*entity.TrxHistory, error)
	StoreToRedis(data *entity.TrxHistory) error
}

func NewRedisRepository

func NewRedisRepository(redisURL string, expiration int) (CacheRepository, error)

type KafkaRepository

type KafkaRepository interface {
	WriteMessage(data *entity.TrxHistory) error
	ReadMessage(res chan<- []byte)
}

func NewKafkaConnection

func NewKafkaConnection(URL, topic string, timeout int) (KafkaRepository, error)

type KafkaService

type KafkaService interface {
	ReadMessage(ctx context.Context, repo Repository, redisRepo CacheRepository) error
}

func NewKafkaService

func NewKafkaService(repo KafkaRepository, redisRepo CacheRepository) KafkaService

type Repository

type Repository interface {
	// Get returns a transaction history information.
	Get(ctx context.Context, id int) (*entity.TrxHistory, error)
	// Save will store a transaction history information into data source.
	Save(ctx context.Context, trxhistory entity.TrxHistory) error
	// SaveByKafka will store a transaction history information into data source.
	SaveByKafka(ctx context.Context, trxhistory entity.TrxHistory) error
}

Repository encapsulates the logic to access paytoken from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

NewRepository creates a new paytoken repository

type Service

type Service interface {
	Get(ctx context.Context, id int) (*entity.TrxHistory, error)
	Save(ctx context.Context, req entity.InputSave) (out entity.OutSave, err error)
}

Service encapsulates usecase logic for albums.

func NewService

func NewService(repo Repository, kafkaRepo KafkaRepository, redisRepo CacheRepository, logger log.Logger) Service

NewService creates a new payment transaction history.

type TrxHistory

type TrxHistory struct {
	entity.TrxHistory
}

TrxHistory represents the data about a transaction history.

Jump to

Keyboard shortcuts

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