contract

package
v0.0.0-...-32983dc Latest Latest
Warning

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

Go to latest
Published: Apr 14, 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 AccountRepo

type AccountRepo interface {
	AddTransfer(ctx context.Context, transferUUID string, accountOriginID, accountDestinationID int64, amount float64) (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)
	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 AccountService

type AccountService 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)
}

type AuthRepo

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

type AuthService

type AuthService 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)
}

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 interface{}) error
	SetStruct(ctx context.Context, key string, data interface{}, expiration time.Duration) error
	SetStructWithExpiration(ctx context.Context, key string, data interface{}, 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
}

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 TransferService

type TransferService 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