Documentation ¶
Index ¶
- func Configure(api *operations.LedgerAPI, service Service)
- func CreateAccount(repo *repository, params *models.CreateTransaction) (string, error)
- func CreateEntity(repo *repository, params *models.CreateTransaction) (string, error)
- func DoesTransactionExist(repo *repository, id string) (bool, string)
- func GetExistingAccount(repo *repository, params *models.CreateTransaction) string
- func GetExistingEntity(repo *repository, entityEntityID string, entityType string) string
- func HandleAccount(repo *repository, params *models.CreateTransaction) (string, error)
- func HandleEntity(repo *repository, params *models.CreateTransaction) (string, error)
- type Repository
- type RunningBalance
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
func Configure(api *operations.LedgerAPI, service Service)
Configure setups handlers on api with Service
func CreateAccount ¶
func CreateAccount(repo *repository, params *models.CreateTransaction) (string, error)
CreateAccount creates a new account
func CreateEntity ¶
func CreateEntity(repo *repository, params *models.CreateTransaction) (string, error)
CreateEntity creates a new entity
func DoesTransactionExist ¶
DoesTransactionExist checks if a given transaction exists
func GetExistingAccount ¶
func GetExistingAccount(repo *repository, params *models.CreateTransaction) string
GetExistingAccount checks if a given account exists and returns the account ID
func GetExistingEntity ¶
GetExistingEntity checks if a given entity exists and returns the entity.id
func HandleAccount ¶
func HandleAccount(repo *repository, params *models.CreateTransaction) (string, error)
HandleAccount checks if a given account exists and returns the account ID If it does not exist it creates the account and returns the new account ID
func HandleEntity ¶
func HandleEntity(repo *repository, params *models.CreateTransaction) (string, error)
HandleEntity checks if a given entity exists and returns the entity.id If it does not exist it creates the entity and returns the new entity.id
Types ¶
type Repository ¶
type Repository interface { ListTransactions(ctx context.Context, params *transactions.ListTransactionsParams) ([]*models.Transaction, error) GetTransactionCount(ctx context.Context) (int64, error) CreateTransaction(ctx context.Context, params *models.CreateTransaction) (*models.Transaction, error) GetTransaction(ctx context.Context, transactionID string) (*models.Transaction, error) }
Repository interface for repo calls
type RunningBalance ¶
type RunningBalance struct { TransactionID string `json:"transaction_id,omitempty"` CurrentRunningBalance int64 `json:"current_running_balance"` TotalCredit int64 `json:"total_credit"` TotalDebit int64 `json:"total_debit"` }
RunningBalance is a struct to hold balance details for a set of transactions for an entity
type Service ¶
type Service interface { ListTransactions(ctx context.Context, params *transactions.ListTransactionsParams) (*models.TransactionList, error) CreateTransaction(ctx context.Context, params *transactions.CreateTransactionParams) (*models.Transaction, error) GetTransaction(ctx context.Context, params *transactions.GetTransactionParams) (*models.Transaction, error) }
Service ...