Documentation ¶
Overview ¶
Package decode unpacks stored programs and values from byte slices
Index ¶
- type Cache
- type CacheMap
- type Key
- type NotImplemented
- type NounInfo
- type Query
- type QueryDecoder
- func (d *QueryDecoder) DecodeAssignment(a affine.Affinity, b []byte) (ret rt.Assignment, err error)
- func (d *QueryDecoder) DecodeField(a affine.Affinity, b []byte, fieldType string) (ret literal.LiteralValue, err error)
- func (d *QueryDecoder) DecodeProg(b []byte) (ret []rt.Execute, err error)
- func (d *QueryDecoder) DecodeValue(out typeinfo.Instance, b []byte) (err error)
- type QueryNone
- func (q QueryNone) ActivateDomains(name string) (_, _ []string, err error)
- func (q QueryNone) Close()
- func (q QueryNone) GetKindByName(rawName string) (_ *rt.Kind, err error)
- func (q QueryNone) IsDomainActive(name string) (_ bool, _ error)
- func (q QueryNone) KindOfAncestors(kind string) (_ []string, _ error)
- func (q QueryNone) LoadGame(path string) (ret CacheMap, err error)
- func (q QueryNone) NounInfo(name string) (_ NounInfo, _ error)
- func (q QueryNone) NounName(id string) (_ string, _ error)
- func (q QueryNone) NounNames(id string) (_ []string, _ error)
- func (q QueryNone) NounValue(id, field string) (_ rt.Assignment, _ error)
- func (q QueryNone) NounsWithAncestor(kind string) (_ []string, _ error)
- func (q QueryNone) PatternLabels(pat string) (_ []string, _ error)
- func (q QueryNone) PluralFromSingular(singular string) (_ string, _ error)
- func (q QueryNone) PluralToSingular(plural string) (_ string, _ error)
- func (q QueryNone) Random(inclusiveMin int, exclusiveMax int) int
- func (q QueryNone) ReciprocalsOf(rel, id string) (_ []string, _ error)
- func (q QueryNone) Relate(rel, noun, otherNoun string) error
- func (q QueryNone) RelativesOf(rel, id string) (_ []string, _ error)
- func (q QueryNone) RulesFor(pat string) (_ RuleSet, _ error)
- func (q QueryNone) SaveGame(path string, dynamicValues CacheMap) error
- type RandomPersist
- type Randomizer
- type RuleSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v0.24.7
type Cache struct { CacheMap // contains filtered or unexported fields }
type NotImplemented ¶
type NotImplemented string
NotImplemented - generic error used returned by QueryNone
func (NotImplemented) Error ¶
func (e NotImplemented) Error() string
type NounInfo ¶
type NounInfo struct {
Domain, Noun, Kind string // noun is unique identifier within the domain.
}
type Query ¶
type Query interface { IsDomainActive(name string) (bool, error) ActivateDomains(name string) (prev, next []string, err error) // GetKindByName(rawName string) (*rt.Kind, error) // given a plural or singular kind // return all ancestors starting with the kind itself. KindOfAncestors(kindOrKinds string) ([]string, error) // search using a short name NounInfo(shortname string) (NounInfo, error) // return the friendly name of the exact named noun NounName(fullname string) (string, error) // find the parser aliases for this noun // warning: the parser expects these to be in alphabetical order. NounNames(fullname string) ([]string, error) // a single field can contain a set of recursive spare values; // so this returns "pairs" of paths and values. NounValue(fullname, field string) (rt.Assignment, error) // all nouns of the indicated kind NounsWithAncestor(kind string) ([]string, error) // the empty string if not found PluralToSingular(plural string) (string, error) // the empty string if not found PluralFromSingular(singular string) (string, error) // includes the parameters, followed by the result // the result can be a blank string for execute statements PatternLabels(pat string) ([]string, error) RulesFor(pat string) (RuleSet, error) ReciprocalsOf(rel, id string) ([]string, error) RelativesOf(rel, id string) ([]string, error) // relations can be cleared by passing a blank string on the opposite side // but -- fix -- there is no way to clear many-many relations. // errors if nothing changed. // doesnt check to see if the relation is valid; // the caller should do that. Relate(rel, noun, otherNoun string) error // LoadGame(path string) (CacheMap, error) SaveGame(path string, dynamicValues CacheMap) error Random(inclusiveMin, exclusiveMax int) int // release all resource Close() }
type QueryDecoder ¶ added in v0.24.7
wraps the base decoder with some additional method
func NewDecoder ¶ added in v0.24.7
func NewDecoder(signatures decode.SignatureTable) *QueryDecoder
func (*QueryDecoder) DecodeAssignment ¶ added in v0.24.7
func (d *QueryDecoder) DecodeAssignment(a affine.Affinity, b []byte) (ret rt.Assignment, err error)
matches with mdl.marshalAssignment the expected eval depends on the affinity (a) of the destination field. fix? merge somehow with express.newAssignment? with compact decoding.
func (*QueryDecoder) DecodeField ¶ added in v0.24.7
func (d *QueryDecoder) DecodeField(a affine.Affinity, b []byte, fieldType string) (ret literal.LiteralValue, err error)
func (*QueryDecoder) DecodeProg ¶ added in v0.24.7
func (d *QueryDecoder) DecodeProg(b []byte) (ret []rt.Execute, err error)
func (*QueryDecoder) DecodeValue ¶ added in v0.24.7
func (d *QueryDecoder) DecodeValue(out typeinfo.Instance, b []byte) (err error)
type QueryNone ¶
type QueryNone string
QueryNone - implements Query by returning empty results for all reads, and the NotImplemented error for mutating methods.
func (QueryNone) ActivateDomains ¶
func (QueryNone) GetKindByName ¶ added in v0.24.7
func (QueryNone) KindOfAncestors ¶
func (QueryNone) NounValue ¶ added in v0.24.7
func (q QueryNone) NounValue(id, field string) (_ rt.Assignment, _ error)
func (QueryNone) NounsWithAncestor ¶ added in v0.24.8
func (QueryNone) PluralFromSingular ¶
func (QueryNone) PluralToSingular ¶
func (QueryNone) ReciprocalsOf ¶
type RandomPersist ¶ added in v0.24.7
type Randomizer ¶ added in v0.24.7
type Randomizer struct {
// contains filtered or unexported fields
}
func RandomizedTime ¶ added in v0.24.7
func RandomizedTime() Randomizer
func SeedRandomizer ¶ added in v0.24.7
func SeedRandomizer(seed1, seed2 uint64) Randomizer
func (*Randomizer) Load ¶ added in v0.24.7
func (r *Randomizer) Load(from RandomPersist) (err error)
func (*Randomizer) Random ¶ added in v0.24.7
func (r *Randomizer) Random(inclusiveMin, exclusiveMax int) int
func (*Randomizer) Save ¶ added in v0.24.7
func (r *Randomizer) Save() (ret RandomPersist, err error)
fix look into implementing BinaryMarshaler directly
Click to show internal directories.
Click to hide internal directories.