account

package
v0.0.0-...-c061cf9 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeUnspecified = Type{""}
	TypeAsset       = Type{"asset"}
	TypeLiability   = Type{"liability"}
	TypeEquity      = Type{"equity"}
	TypeRevenue     = Type{"revenue"}
	TypeExpense     = Type{"expense"}
	TypeGain        = Type{"gain"}
	TypeLoss        = Type{"loss"}
)

safer enums for Type enum

View Source
var (
	BasisUnspecified = Basis{""}
	BasisDebit       = Basis{"debit"}
	BasisCredit      = Basis{"credit"}
)
View Source
var ErrParseType = errors.New("error parsing string as type")

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        string    `validate:"required,KSUID"`
	ParentID  string    `validate:"omitempty,KSUID"`
	Name      string    `validate:"required"`
	Type      Type      `validate:"required"`
	Basis     Basis     `validate:"required"`
	CreatedAt time.Time `validate:"required"`
}

Account represents a collection of entries into a logical grouping

func (Account) String

func (a Account) String() string

type Basis

type Basis struct {
	// Slug should not be accessed by dependent code. It is exported for validation reasons
	Slug string `validate:"oneof=debit credit"`
}

func ParseBasis

func ParseBasis(b string) Basis

func (Basis) String

func (b Basis) String() string

type Type

type Type struct {
	// Slug should not be accessed by dependent code. It is exported for validation reasons
	Slug string `validate:"oneof=asset liability equity revenue expense gain loss"`
}

Type represents the type of account

func ParseType

func ParseType(t string) Type

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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