yn

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 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 CodeVerify added in v1.0.3

func CodeVerify(codeStr string) *errors.Error

func CtxToData added in v1.0.3

func CtxToData(c Ctx) ([]byte, *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 Code added in v1.0.3

type Code string
const (
	NilCode Code = ""
)

func CodeOf added in v1.0.3

func CodeOf(codeStr string) (Code, *errors.Error)

func (Code) S added in v1.0.3

func (a Code) 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)

func (*Expense) S added in v1.0.3

func (exp *Expense) S() string

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)

func (*Ref) S added in v1.0.3

func (ref *Ref) S() string

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)

type Title

type Title string
const (
	NilTitle Title = ""
)

func TitleOf

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

func (Title) S added in v1.0.3

func (t Title) S() string

type What

type What Ref

func NewWhat

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

func (*What) S added in v1.0.3

func (what *What) S() string

type When

type When int64

func NewWhen

func NewWhen() When

func (When) S added in v1.0.3

func (w When) S() string

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)

func (*Who) S added in v1.0.3

func (who *Who) S() string

type YID

type YID = string

type Yin

type Yin struct {
	Yin   Code     `bson:"yin" json:"yin"`
	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() string

func (*Yin) GetVN

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

func (*Yin) Summary added in v1.0.3

func (y *Yin) Summary() string

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