Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("transaction not found") ErrInvalidUUID = errors.New("invalid syntax of uuid") ErrInvalidID = errors.New("invalid transaction id") ErrInvalidDetail = errors.New("invalid transaction detail") ErrNotEnough = errors.New("not enough credits") ErrAlreadyApplied = errors.New("credits already applied") )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repository TransactionRepository) *Service
func (Service) GetBalance ¶
type Transaction ¶
type TransactionRepository ¶
type TransactionRepository interface {
CreateEntry(ctx context.Context, debit, credit Transaction) ([]Transaction, error)
GetBalance(ctx context.Context, id string) (int64, error)
List(ctx context.Context, flt Filter) ([]Transaction, error)
GetByID(ctx context.Context, id string) (Transaction, error)
}
type TransactionType ¶
type TransactionType string
const ( TypeDebit TransactionType = "debit" TypeCredit TransactionType = "credit" )
Click to show internal directories.
Click to hide internal directories.