repository

package
v0.0.0-...-5a278c4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotExist = fmt.Errorf("client not exists")
View Source
var ErrLimitExceeded = fmt.Errorf("client does not have sufficient limit")

Functions

func WithTransaction

func WithTransaction(ctx context.Context, db *sql.DB, fn TxFn) (err error)

WithTransaction creates a new transaction and handles rollback/commit based on the error object returned by the `TxFn`

Types

type Repository

type Repository interface {
	SaveTransaction(ctx context.Context, clientID int, data *entity.TransactionInput) (*entity.TransactionOutput, error)
	GetUserStatement(ctx context.Context, clientID int) (*entity.StatementOutput, error)
}

func NewMysqlRepository

func NewMysqlRepository(dbUser, dbPass, dbName, dbAddress string) (Repository, error)

type TxFn

type TxFn func(*sql.Tx) error

A Txfn is a function that will be called with an initialized `Transaction` object that can be used for executing statements and queries against a database.

Jump to

Keyboard shortcuts

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