transaction

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Income   = Type{IncomeType}
	Expense  = Type{ExpenseType}
	Transfer = Type{TransferType}
)

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Count(ctx context.Context) (int64, error)
	GetAll(ctx context.Context) ([]*Transaction, error)
	GetPaginated(ctx context.Context, limit, offset int, sortBy []string) ([]*Transaction, error)
	GetByID(ctx context.Context, id int64) (*Transaction, error)
	Create(ctx context.Context, upload *Transaction) error
	Update(ctx context.Context, upload *Transaction) error
	Delete(ctx context.Context, id int64) error
}

type Transaction

type Transaction struct {
	ID                   uint
	Amount               float64
	AmountCurrencyID     string
	OriginAccountID      *uint
	DestinationAccountID *uint
	TransactionDate      time.Time
	AccountingPeriod     time.Time
	TransactionType      Type
	Comment              string
	CreatedAt            time.Time
}

type Type

type Type struct {
	// contains filtered or unexported fields
}

func NewType

func NewType(value string) (Type, error)

func (Type) Get

func (p Type) Get() TypeEnum

func (Type) String

func (p Type) String() string

type TypeEnum

type TypeEnum string
const (
	IncomeType   TypeEnum = "income"
	ExpenseType  TypeEnum = "expense"
	TransferType TypeEnum = "transfer"
)

func (TypeEnum) IsValid

func (s TypeEnum) IsValid() bool

Jump to

Keyboard shortcuts

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