yn

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActVerify

func ActVerify(actStr string) *errors.Error

func CurrencyVerify

func CurrencyVerify(str string) *errors.Error

func TitleVerify

func TitleVerify(tilStr string) *errors.Error

Types

type Act

type Act string
const (
	NilAct Act = ""
)

func ActOf

func ActOf(actStr string) (Act, *errors.Error)

func (Act) S

func (a Act) S() string

type Ctx

type Ctx map[string]string

func NewCtx

func NewCtx() Ctx

func (Ctx) Put

func (c Ctx) Put(code string, val string) *errors.Error

type Currency

type Currency string
const (
	NilCurrency Currency = ""
)

func CurrencyOf

func CurrencyOf(str string) (Currency, *errors.Error)

type Expense

type Expense struct {
	Amount   int64                   `bson:"amount" json:"amount"`
	Currency Currency                `bson:"currency" json:"currency"`
	Ex       map[string]*ExpenseItem `bson:"ex,omitempty" json:"ex,omitempty"`
}

func NewExpense

func NewExpense(currencyStr string, amount int64) (*Expense, *errors.Error)

func (*Expense) PutEx

func (exp *Expense) PutEx(code string, exExp *ExpenseItem)

type ExpenseItem

type ExpenseItem struct {
	Amount   int64    `bson:"amount" json:"amount"`
	Currency Currency `bson:"currency" json:"currency"`
}

type Ref

type Ref struct {
	Code string `bson:"code" json:"code"`
	Ref  string `bson:"ref" json:"ref"`
}

func RefOf

func RefOf(codeStr string, refStr string) (*Ref, *errors.Error)

type Tag

type Tag string
const (
	NilTag Tag = ""
)

func TagAppend

func TagAppend(tags []Tag, tag Tag) []Tag

func TagOf

func TagOf(tagStr string) (Tag, *errors.Error)

func (Tag) S

func (t Tag) S() string

type Title

type Title string
const (
	NilTitle Title = ""
)

func TitleOf

func TitleOf(tilStr string) (Title, *errors.Error)

type What

type What Ref

func NewWhat

func NewWhat(codeStr string, refStr string) (*What, *errors.Error)

type When

type When int64

func NewWhen

func NewWhen() When

func (When) Time

func (w When) Time() time.Time

type Who

type Who struct {
	Who ki.ADR `bson:"who" json:"who"`
	Ref *Ref   `bson:"ref" json:"ref"`
}

func NewWho

func NewWho(whoStr string, refCode string, refRef string) (*Who, *errors.Error)

type YID

type YID = bk.BID

type Yin

type Yin struct {
	Vn    vn.ID    `bson:"vn" json:"vn" cbor:"vn"`
	Sp    sp.ID    `bson:"sp" json:"sp" cbor:"sp"`
	Who   *Who     `bson:"who" json:"who"`
	When  When     `bson:"when" json:"when"`
	Act   Act      `bson:"act" json:"act"`
	What  *What    `bson:"what" json:"what"`
	Exp   *Expense `bson:"exp" json:"exp"`
	Title Title    `bson:"title" json:"title"`
	Tag   []Tag    `bson:"tag" json:"tag"`
	Ctx   Ctx      `bson:"ctx" json:"ctx"`
}

func NewYin

func NewYin(vnIDStr string, spIDStr string) (*Yin, *errors.Error)

func (*Yin) Digest

func (y *Yin) Digest() string

func (*Yin) GetSP

func (y *Yin) GetSP() sp.ID

func (*Yin) GetType

func (y *Yin) GetType() bk.Type

func (*Yin) GetVN

func (y *Yin) GetVN() vn.ID

func (*Yin) Verify

func (y *Yin) Verify() *errors.Error

func (*Yin) WithAct

func (y *Yin) WithAct(actStr string) *errors.Error

func (*Yin) WithCtx

func (y *Yin) WithCtx(codeStr string, valStr string) *errors.Error

func (*Yin) WithExpense

func (y *Yin) WithExpense(currencyStr string, amount int64) *errors.Error

func (*Yin) WithTag

func (y *Yin) WithTag(tagStrArr ...string) *errors.Error

func (*Yin) WithTitle

func (y *Yin) WithTitle(tilStr string) *errors.Error

func (*Yin) WithWhat

func (y *Yin) WithWhat(codeStr string, refStr string) *errors.Error

func (*Yin) WithWho

func (y *Yin) WithWho(whoStr string, refCode string, refRef string) *errors.Error

Jump to

Keyboard shortcuts

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