contract

package
v0.0.0-...-60b29a0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountApp

type AccountApp interface {
	CreateAccount(ctx context.Context, input dto.AccountInput) (err error)
	AddBalance(ctx context.Context, input dto.AddBalanceInput) (err error)
	GetAccounts(ctx context.Context, take, skip int64) (accounts []entity.Account, totalRecords int64, err error)
	GetAccountByUUID(ctx context.Context, accountUUID string) (account entity.Account, err error)
	GetLoggedAccount(ctx context.Context) (account entity.Account, err error)
	GetLoggedAccountID(ctx context.Context) (accountID int64, err error)
}

type AccountRepo

type AccountRepo interface {
	AddTransfer(ctx context.Context, transferUUID string, accountOriginID, accountDestinationID int64, amount float64) (transferID int64, err error)
	CreateAccount(ctx context.Context, account entity.Account) (createdID int64, err error)
	GetAccountByDocument(ctx context.Context, encryptedCPF string) (account entity.Account, err error)
	GetAccounts(ctx context.Context, take, skip int64) (accounts []entity.Account, totalRecords int64, err error)
	GetAccountByUUID(ctx context.Context, accountUUID string) (account entity.Account, err error)
	GetAccountIDByUUID(ctx context.Context, accountUUID string) (accountID int64, err error)
	GetTransfersByAccountID(ctx context.Context, accountID, take, skip int64, origin bool) (transfers []entity.Transfer, totalRecords int64, err error)
	UpdateAccountBalance(ctx context.Context, accountID int64, balance float64) (err error)
}

type AuthApp

type AuthApp interface {
	Login(ctx context.Context, input dto.LoginInput) (account entity.Account, err error)
	CreateSession(ctx context.Context, session dto.Session) (err error)
	GetSessionByUUID(ctx context.Context, sessionUUID string) (session dto.Session, err error)
	Logout(ctx context.Context, accessToken string) (err error)
}

type AuthRepo

type AuthRepo interface {
	CreateSession(ctx context.Context, session dto.Session) (sessionID int64, err error)
	GetSessionByUUID(ctx context.Context, sessionUUID string) (session dto.Session, err error)
	SetSessionAsBlocked(ctx context.Context, accountID int64) (err error)
}

type CacheManager

type CacheManager interface {
	GetItem(ctx context.Context, key string) ([]byte, error)
	SetItem(ctx context.Context, key string, data []byte) error
	SetItemWithExpiration(ctx context.Context, key string, data []byte, expiration time.Duration) error

	GetString(ctx context.Context, key string) (string, error)
	SetString(ctx context.Context, key string, data string) error
	SetStringWithExpiration(ctx context.Context, key string, data string, expiration time.Duration) error

	GetInt(ctx context.Context, key string) (data int64, err error)
	Increase(ctx context.Context, key string) error

	GetStruct(ctx context.Context, key string, data any) error
	SetStruct(ctx context.Context, key string, data any) error
	SetStructWithExpiration(ctx context.Context, key string, data any, expiration time.Duration) error

	GetExpiration(ctx context.Context, key string) (time.Duration, error)
	SetExpiration(ctx context.Context, key string, expiration time.Duration) error

	Delete(ctx context.Context, keys ...string) error
	CleanAll(ctx context.Context) error
	GetAllKeys(ctx context.Context, pattern string) ([]string, error)
}

CacheManager defines the main caching interface

  • Get methods can return domain.ErrCacheMiss

type Crypto

type Crypto interface {
	HashPassword(password string) (string, error)
	CheckPassword(password, hashedPassword string) error
}

type DataManager

type DataManager interface {
	WithTransaction(ctx context.Context, fn func(r DataManager) error) error
	Account() AccountRepo
	Auth() AuthRepo
}

DataManager holds the methods that manipulates the main data.

type TransferApp

type TransferApp interface {
	CreateTransfer(ctx context.Context, transfer dto.TransferInput) (err error)
	GetTransfers(ctx context.Context, take, skip int64) (transfers []entity.Transfer, totalRecords int64, err error)
}

Jump to

Keyboard shortcuts

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