Documentation ¶
Index ¶
- Constants
- Variables
- func AddInfo(name string, ref any) struct{}
- func Alert(args ...any)
- func AlertCancel(args ...any) bool
- func AsStr(x Value) string
- func CompareSuTimestamp(d1, d2 SuTimestamp) int
- func Disasm(fn *SuFunc, out outfn)
- func DisasmMixed(fn *SuFunc, src string) string
- func DisasmOps(fn *SuFunc) string
- func DisasmRaw(code string, fn func(i int))
- func Display(th *Thread, val Value) string
- func EqualRows(hdr1 *Header, r1 Row, hdr2 *Header, r2 Row, cols []string, th *Thread, ...) bool
- func ErrType(x Value) string
- func Fatal(args ...any)
- func Fatal2(string)
- func IfInt(x Value) int
- func InfoList() []string
- func InstantiateMax(n int)
- func LogInternalError(th *Thread, from string, e any)
- func LogUncaught(th *Thread, where string, e any)
- func OpBool(x Value) bool
- func Pack(x Packable) string
- func Pack2(x Packable) *pack.Encoder
- func PackSize(v Value) int
- func PackValue(v Value) string
- func PackedCmpLower(s1, s2 string) int
- func PackedToLower(s string) string
- func PrintStack(cs *SuObject)
- func RecLen(r []byte) int
- func Show(v Value) string
- func SuInt(n int) *smi
- func SuIntToInt(x any) (int, bool)
- func ToBool(x Value) bool
- func ToDnum(x Value) dnum.Dnum
- func ToIndex(key Value) int
- func ToInt(x Value) int
- func ToInt64(x Value) int64
- func ToStr(x Value) string
- func ToStrOrString(x Value) string
- func Unquoted(k Value) string
- func Warning(args ...any)
- func WithType(x Value) string
- func WrapPanic(e any, suffix string)
- type ActiveObserverList
- type ArgSpec
- type ArgsIter
- type BuiltinParams
- type Callable
- type Container
- type DbRec
- type Dir
- type Displayable
- type Findable
- type Flag
- type Frame
- type Gnum
- type Header
- func (hdr *Header) AppendDerived(fields []string) []string
- func (hdr *Header) Dup() *Header
- func (hdr *Header) EqualRows(r1, r2 Row, th *Thread, st *SuTran) bool
- func (hdr *Header) GetFields() []string
- func (hdr *Header) HasDeleted() bool
- func (hdr *Header) HasField(col string) bool
- func (hdr *Header) Physical() []string
- func (hdr *Header) Rules() []string
- func (hdr *Header) Schema() []string
- type HmapValue
- type ICursor
- type IDbms
- type IQuery
- type IQueryCursor
- type ISuQueryCursor
- type ITran
- type Iter
- type MayLock
- type MemBase
- type Methods
- type Named
- type Ord
- type Packable
- type PackableValue
- type Packed
- type ParamSpec
- func (ps *ParamSpec) Compare(other Value) int
- func (ps *ParamSpec) Equal(other any) bool
- func (ps *ParamSpec) GetName() string
- func (*ParamSpec) Lookup(_ *Thread, method string) Callable
- func (ps *ParamSpec) ParamName(i int) string
- func (ps *ParamSpec) Params() string
- func (ParamSpec) SetConcurrent()
- func (ps *ParamSpec) Show() string
- func (ps *ParamSpec) String() string
- type Record
- type RecordBuilder
- type Row
- type Showable
- type Status
- type SuBool
- func (b SuBool) AsStr() (string, bool)
- func (SuBool) Call(*Thread, Value, *ArgSpec) Value
- func (b SuBool) Compare(other Value) int
- func (b SuBool) Equal(other any) bool
- func (SuBool) Get(*Thread, Value) Value
- func (SuBool) GetPut(*Thread, Value, Value, func(x, y Value) Value, bool) Value
- func (b SuBool) Hash() uint32
- func (b SuBool) Hash2() uint32
- func (b SuBool) IfInt() (int, bool)
- func (SuBool) Lookup(*Thread, string) Callable
- func (b SuBool) Not() SuBool
- func (b SuBool) Pack(_ *uint32, buf *pack.Encoder)
- func (SuBool) PackSize(*uint32) int
- func (SuBool) PackSize2(*uint32, packStack) int
- func (SuBool) Put(*Thread, Value, Value)
- func (SuBool) RangeLen(int, int) Value
- func (SuBool) RangeTo(int, int) Value
- func (SuBool) SetConcurrent()
- func (b SuBool) String() string
- func (SuBool) ToContainer() (Container, bool)
- func (b SuBool) ToDnum() (dnum.Dnum, bool)
- func (b SuBool) ToInt() (int, bool)
- func (b SuBool) ToStr() (string, bool)
- func (SuBool) Type() types.Type
- type SuBuiltin
- type SuBuiltin0
- type SuBuiltin1
- type SuBuiltin2
- type SuBuiltin3
- type SuBuiltin4
- type SuBuiltin5
- type SuBuiltin6
- type SuBuiltin7
- type SuBuiltinMethod
- type SuBuiltinMethod0
- type SuBuiltinMethod1
- type SuBuiltinMethod2
- type SuBuiltinMethod3
- type SuBuiltinMethodRaw
- type SuBuiltinRaw
- type SuClass
- func (c *SuClass) Call(th *Thread, this Value, as *ArgSpec) Value
- func (c *SuClass) Equal(other any) bool
- func (c *SuClass) Finder(th *Thread, fn func(v Value, mb *MemBase) Value) Value
- func (c *SuClass) Get(th *Thread, m Value) Value
- func (c *SuClass) GetName() string
- func (c *SuClass) GetParents() []*SuClass
- func (*SuClass) IsConcurrent() Value
- func (c *SuClass) Lookup(th *Thread, method string) Callable
- func (c *SuClass) New(th *Thread, as *ArgSpec) *SuInstance
- func (c *SuClass) Parent(th *Thread) *SuClass
- func (*SuClass) SetConcurrent()
- func (c *SuClass) SetParents(parents []*SuClass)
- func (c *SuClass) Show() string
- func (c *SuClass) StartCoverage(count bool)
- func (c *SuClass) StopCoverage() *SuObject
- func (c *SuClass) String() string
- func (*SuClass) Type() types.Type
- type SuClosure
- type SuConcat
- func (c SuConcat) Add(s string) SuConcat
- func (c SuConcat) AsStr() (string, bool)
- func (c SuConcat) Call(th *Thread, this Value, as *ArgSpec) Value
- func (c SuConcat) Compare(other Value) int
- func (c SuConcat) Equal(other any) bool
- func (c SuConcat) Get(_ *Thread, key Value) Value
- func (c SuConcat) Hash() uint32
- func (c SuConcat) Hash2() uint32
- func (c SuConcat) IsConcurrent() Value
- func (c SuConcat) Iter() Iter
- func (c SuConcat) Len() int
- func (SuConcat) Lookup(th *Thread, method string) Callable
- func (c SuConcat) Pack(_ *uint32, buf *pack.Encoder)
- func (c SuConcat) PackSize(*uint32) int
- func (c SuConcat) PackSize2(*uint32, packStack) int
- func (c SuConcat) RangeLen(from int, n int) Value
- func (c SuConcat) RangeTo(from int, to int) Value
- func (c SuConcat) SetConcurrent()
- func (c SuConcat) String() string
- func (c SuConcat) ToDnum() (dnum.Dnum, bool)
- func (c SuConcat) ToInt() (int, bool)
- func (c SuConcat) ToStr() (string, bool)
- func (SuConcat) Type() types.Type
- type SuCursor
- type SuDate
- func DateTime(date uint32, time uint32) SuDate
- func FromGoTime(t time.Time) SuDate
- func NewDate(yr int, mon int, day int, hr int, min int, sec int, ms int) SuDate
- func NormalizeDate(yr int, mon int, day int, hr int, min int, sec int, ms int) SuDate
- func Now() SuDate
- func ParseDate(s string, order string) SuDate
- func SuDateFromUnixMilli(t int64) SuDate
- func (d SuDate) AddMs(ms int) SuDate
- func (d SuDate) Compare(other Value) int
- func (d SuDate) Day() int
- func (d SuDate) Equal(other any) bool
- func (d SuDate) Format(fmt string) string
- func (d SuDate) Hash() uint32
- func (d SuDate) Hash2() uint32
- func (d SuDate) Hour() int
- func (SuDate) Lookup(th *Thread, method string) Callable
- func (d SuDate) Millisecond() int
- func (d SuDate) MinusDays(other SuDate) int
- func (d SuDate) MinusMs(other SuDate) int64
- func (d SuDate) Minute() int
- func (d SuDate) Month() int
- func (d SuDate) Pack(_ *uint32, buf *pack.Encoder)
- func (SuDate) PackSize(*uint32) int
- func (SuDate) PackSize2(*uint32, packStack) int
- func (d SuDate) Plus(yr int, mon int, day int, hr int, min int, sec int, ms int) SuDate
- func (d SuDate) Second() int
- func (SuDate) SetConcurrent()
- func (d SuDate) String() string
- func (d SuDate) ToGoTime() time.Time
- func (SuDate) Type() types.Type
- func (d SuDate) UnixMilli() int64
- func (d SuDate) WeekDay() int
- func (d SuDate) WithoutMs() SuDate
- func (d SuDate) Year() int
- type SuDnum
- func (dn SuDnum) AsStr() (string, bool)
- func (dn SuDnum) Compare(other Value) int
- func (dn SuDnum) Equal(other any) bool
- func (dn SuDnum) Hash() uint32
- func (dn SuDnum) Hash2() uint32
- func (dn SuDnum) IfInt() (int, bool)
- func (SuDnum) Lookup(th *Thread, method string) Callable
- func (dn SuDnum) Pack(_ *uint32, buf *pack.Encoder)
- func (dn SuDnum) PackSize(*uint32) int
- func (dn SuDnum) PackSize2(*uint32, packStack) int
- func (SuDnum) SetConcurrent()
- func (dn SuDnum) String() string
- func (dn SuDnum) ToDnum() (dnum.Dnum, bool)
- func (dn SuDnum) ToInt() (int, bool)
- func (SuDnum) Type() types.Type
- type SuExcept
- type SuFunc
- func (f *SuFunc) Call(th *Thread, this Value, as *ArgSpec) Value
- func (f *SuFunc) CodeToSrcPos(ip int) int
- func (*SuFunc) Lookup(_ *Thread, method string) Callable
- func (f *SuFunc) StartCoverage(count bool)
- func (f *SuFunc) StopCoverage() *SuObject
- func (f *SuFunc) String() string
- func (f *SuFunc) Type() types.Type
- type SuInstance
- func (ob *SuInstance) Base() *SuClass
- func (ob *SuInstance) Call(th *Thread, _ Value, as *ArgSpec) Value
- func (ob *SuInstance) Clear()
- func (ob *SuInstance) Copy() *SuInstance
- func (ob *SuInstance) Delete(key Value)
- func (ob *SuInstance) Equal(other any) bool
- func (ob *SuInstance) Finder(_ *Thread, fn func(Value, *MemBase) Value) Value
- func (ob *SuInstance) Get(th *Thread, m Value) Value
- func (ob *SuInstance) GetPut(th *Thread, m Value, v Value, op func(x, y Value) Value, retOrig bool) Value
- func (ob *SuInstance) Lookup(th *Thread, method string) Callable
- func (ob *SuInstance) Put(_ *Thread, m Value, v Value)
- func (ob *SuInstance) SetConcurrent()
- func (ob *SuInstance) String() string
- func (ob *SuInstance) ToString(th *Thread) string
- func (*SuInstance) Type() types.Type
- type SuIter
- type SuMethod
- func (m *SuMethod) Call(th *Thread, _ Value, as *ArgSpec) Value
- func (m *SuMethod) Equal(other any) bool
- func (m *SuMethod) GetFn() Value
- func (m *SuMethod) GetName() string
- func (m *SuMethod) Lookup(th *Thread, method string) Callable
- func (m *SuMethod) SetConcurrent()
- func (m *SuMethod) String() string
- func (*SuMethod) Type() types.Type
- type SuObject
- func (ob *SuObject) Add(val Value)
- func (ob *SuObject) ArgsIter() func() (Value, Value)
- func (ob *SuObject) BinarySearch(value Value) int
- func (ob *SuObject) BinarySearch2(th *Thread, value, lt Value) int
- func (*SuObject) Call(*Thread, Value, *ArgSpec) Value
- func (ob *SuObject) Compare(other Value) int
- func (ob *SuObject) Copy() Container
- func (ob *SuObject) Delete(_ *Thread, key Value) bool
- func (ob *SuObject) DeleteAll()
- func (ob *SuObject) Display(th *Thread) string
- func (ob *SuObject) Equal(other any) bool
- func (ob *SuObject) Erase(_ *Thread, key Value) bool
- func (ob *SuObject) Find(val Value) Value
- func (ob *SuObject) Get(_ *Thread, key Value) Value
- func (ob *SuObject) GetIfPresent(_ *Thread, key Value) Value
- func (ob *SuObject) GetPut(_ *Thread, m, v Value, op func(x, y Value) Value, retOrig bool) Value
- func (ob *SuObject) HasKey(key Value) bool
- func (ob *SuObject) Hash() uint32
- func (ob *SuObject) Hash2() uint32
- func (ob *SuObject) Insert(at int, val Value)
- func (ob *SuObject) IsConcurrent() Value
- func (ob *SuObject) IsReadOnly() bool
- func (ob *SuObject) Iter() Iter
- func (ob *SuObject) Iter2(list, named bool) func() (Value, Value)
- func (ob *SuObject) ListGet(i int) Value
- func (ob *SuObject) ListSize() int
- func (x *SuObject) Lock() bool
- func (*SuObject) Lookup(th *Thread, method string) Callable
- func (ob *SuObject) NamedSize() int
- func (ob *SuObject) Pack(hash *uint32, buf *pack.Encoder)
- func (ob *SuObject) PackSize(hash *uint32) int
- func (ob *SuObject) PackSize2(hash *uint32, stack packStack) int
- func (ob *SuObject) PopFirst() Value
- func (ob *SuObject) PopLast() Value
- func (ob *SuObject) Put(_ *Thread, key, val Value)
- func (x *SuObject) RLock() bool
- func (x *SuObject) RUnlock() bool
- func (ob *SuObject) RangeLen(from int, n int) Value
- func (ob *SuObject) RangeTo(from int, to int) Value
- func (ob *SuObject) Reverse()
- func (ob *SuObject) Set(key, val Value)
- func (ob *SuObject) SetChildConc()
- func (ob *SuObject) SetConcurrent()
- func (ob *SuObject) SetDefault(def Value)
- func (ob *SuObject) SetReadOnly()
- func (ob *SuObject) Show() string
- func (ob *SuObject) Size() int
- func (ob *SuObject) Slice(n int) Container
- func (ob *SuObject) Sort(th *Thread, lt Value)
- func (ob *SuObject) String() string
- func (ob *SuObject) ToContainer() (Container, bool)
- func (ob *SuObject) ToObject() *SuObject
- func (ob *SuObject) ToRecord(th *Thread, hdr *Header) Record
- func (*SuObject) Type() types.Type
- func (ob *SuObject) Unique()
- func (x *SuObject) Unlock() bool
- type SuQuery
- func (q *SuQuery) Equal(other any) bool
- func (q *SuQuery) GetRec(th *Thread, dir Dir) Value
- func (q *SuQuery) Lookup(_ *Thread, method string) Callable
- func (q *SuQuery) Output(th *Thread, ob Container)
- func (*SuQuery) SetConcurrent()
- func (q *SuQuery) String() string
- func (*SuQuery) Type() types.Type
- type SuQueryCursor
- type SuRecord
- func (r *SuRecord) Add(val Value)
- func (r *SuRecord) ArgsIter() func() (Value, Value)
- func (r *SuRecord) AttachRule(key, callable Value)
- func (r *SuRecord) Clear()
- func (r *SuRecord) Compare(other Value) int
- func (r *SuRecord) Copy() Container
- func (r *SuRecord) DbDelete(th *Thread)
- func (r *SuRecord) DbUpdate(th *Thread, ob Value)
- func (r *SuRecord) Delete(th *Thread, key Value) bool
- func (r *SuRecord) DeleteAll()
- func (r *SuRecord) Display(th *Thread) string
- func (r *SuRecord) Equal(other any) bool
- func (r *SuRecord) Erase(th *Thread, key Value) bool
- func (r *SuRecord) Get(th *Thread, key Value) Value
- func (r *SuRecord) GetDeps(key string) Value
- func (r *SuRecord) GetIfPresent(th *Thread, keyval Value) Value
- func (r *SuRecord) GetPut(th *Thread, m, v Value, op func(x, y Value) Value, retOrig bool) Value
- func (r *SuRecord) HasKey(key Value) bool
- func (r *SuRecord) Hash() uint32
- func (r *SuRecord) Hash2() uint32
- func (r *SuRecord) Insert(at int, val Value)
- func (r *SuRecord) Invalidate(th *Thread, key string)
- func (r *SuRecord) IsConcurrent() Value
- func (r *SuRecord) IsNew() bool
- func (r *SuRecord) IsReadOnly() bool
- func (r *SuRecord) Iter() Iter
- func (r *SuRecord) Iter2(list bool, named bool) func() (Value, Value)
- func (r *SuRecord) ListGet(i int) Value
- func (r *SuRecord) ListSize() int
- func (r *SuRecord) Lock() bool
- func (*SuRecord) Lookup(th *Thread, method string) Callable
- func (r *SuRecord) NamedSize() int
- func (r *SuRecord) Observer(ofn Value)
- func (r *SuRecord) Pack(hash *uint32, buf *pack.Encoder)
- func (r *SuRecord) PackSize(hash *uint32) int
- func (r *SuRecord) PackSize2(hash *uint32, stack packStack) int
- func (r *SuRecord) PreSet(key, val Value)
- func (r *SuRecord) Put(th *Thread, keyval, val Value)
- func (r *SuRecord) RangeLen(from int, n int) Value
- func (r *SuRecord) RangeTo(from int, to int) Value
- func (r *SuRecord) RemoveObserver(ofn Value) bool
- func (r *SuRecord) Set(key, val Value)
- func (r *SuRecord) SetConcurrent()
- func (r *SuRecord) SetDeps(key, deps string)
- func (r *SuRecord) SetReadOnly()
- func (r *SuRecord) Show() string
- func (r *SuRecord) Slice(n int) Container
- func (r *SuRecord) String() string
- func (r *SuRecord) ToContainer() (Container, bool)
- func (r *SuRecord) ToObject() *SuObject
- func (r *SuRecord) ToRecord(th *Thread, hdr *Header) Record
- func (r *SuRecord) Transaction() *SuTran
- func (*SuRecord) Type() types.Type
- func (r *SuRecord) Unlock() bool
- type SuRegex
- type SuSequence
- func (seq *SuSequence) Compare(other Value) int
- func (seq *SuSequence) Copy() Value
- func (seq *SuSequence) Equal(other any) bool
- func (seq *SuSequence) Get(th *Thread, key Value) Value
- func (seq *SuSequence) GetPut(th *Thread, key Value, val Value, op func(x, y Value) Value, retOrig bool) Value
- func (seq *SuSequence) Hash() uint32
- func (seq *SuSequence) Hash2() uint32
- func (seq *SuSequence) Infinite() bool
- func (seq *SuSequence) Instantiated() bool
- func (seq *SuSequence) Iter() Iter
- func (seq *SuSequence) Lookup(th *Thread, method string) Callable
- func (seq *SuSequence) Pack(hash *uint32, buf *pack.Encoder)
- func (seq *SuSequence) PackSize(hash *uint32) int
- func (seq *SuSequence) PackSize2(hash *uint32, stack packStack) int
- func (seq *SuSequence) Put(th *Thread, key Value, val Value)
- func (seq *SuSequence) RangeLen(i int, n int) Value
- func (seq *SuSequence) RangeTo(i int, j int) Value
- func (seq *SuSequence) SetConcurrent()
- func (seq *SuSequence) String() string
- func (seq *SuSequence) ToContainer() (Container, bool)
- func (*SuSequence) Type() types.Type
- type SuStr
- func (ss SuStr) AsStr() (string, bool)
- func (ss SuStr) Call(th *Thread, _ Value, as *ArgSpec) Value
- func (ss SuStr) Compare(other Value) int
- func (ss SuStr) Display(th *Thread) string
- func (ss SuStr) Equal(other any) bool
- func (ss SuStr) Get(_ *Thread, key Value) Value
- func (SuStr) GetPut(*Thread, Value, Value, func(x, y Value) Value, bool) Value
- func (ss SuStr) Hash() uint32
- func (ss SuStr) Hash2() uint32
- func (ss SuStr) IfInt() (int, bool)
- func (ss SuStr) Iter() Iter
- func (ss SuStr) Len() int
- func (SuStr) Lookup(th *Thread, method string) Callable
- func (ss SuStr) Pack(_ *uint32, buf *pack.Encoder)
- func (ss SuStr) PackSize(*uint32) int
- func (ss SuStr) PackSize2(*uint32, packStack) int
- func (SuStr) Put(*Thread, Value, Value)
- func (ss SuStr) RangeLen(from int, n int) Value
- func (ss SuStr) RangeTo(from int, to int) Value
- func (SuStr) SetConcurrent()
- func (ss SuStr) String() string
- func (SuStr) ToContainer() (Container, bool)
- func (ss SuStr) ToDnum() (dnum.Dnum, bool)
- func (ss SuStr) ToInt() (int, bool)
- func (ss SuStr) ToStr() (string, bool)
- func (SuStr) Type() types.Type
- type SuTimestamp
- func (d SuTimestamp) Compare(other Value) int
- func (d SuTimestamp) Equal(other any) bool
- func (d SuTimestamp) Hash() uint32
- func (d SuTimestamp) Pack(h *uint32, buf *pack.Encoder)
- func (SuTimestamp) PackSize(*uint32) int
- func (SuTimestamp) PackSize2(*uint32, packStack) int
- func (d SuTimestamp) String() string
- type SuTran
- func (st *SuTran) Action(th *Thread, action string) int
- func (st *SuTran) Asof(val Value) Value
- func (st *SuTran) Complete()
- func (st *SuTran) Data() *SuObject
- func (st *SuTran) Delete(th *Thread, table string, off uint64)
- func (st *SuTran) Ended() bool
- func (st *SuTran) Equal(other any) bool
- func (st *SuTran) GetRow(th *Thread, query string, dir Dir) (Row, *Header, string)
- func (st *SuTran) Lookup(th *Thread, method string) Callable
- func (st *SuTran) Query(th *Thread, query string) *SuQuery
- func (st *SuTran) ReadCount() int
- func (st *SuTran) Rollback()
- func (st *SuTran) SetConcurrent()
- func (st *SuTran) String() string
- func (*SuTran) Type() types.Type
- func (st *SuTran) Updatable() bool
- func (st *SuTran) Update(th *Thread, table string, off uint64, rec Record) uint64
- func (st *SuTran) WriteCount() int
- type SuneidoObject
- type Sviews
- type Thread
- func (th *Thread) Args(ps *ParamSpec, as *ArgSpec) []Value
- func (th *Thread) Call(fn Callable, args ...Value) Value
- func (th *Thread) CallEach(fn Callable, arg Value) Value
- func (th *Thread) CallEach1(fn Callable, arg Value) Value
- func (th *Thread) CallLookup(this Value, method string, args ...Value) Value
- func (th *Thread) CallLookupEach1(this Value, method string, arg Value) Value
- func (th *Thread) CallThis(fn Callable, this Value, args ...Value) Value
- func (th *Thread) Callstack() *SuObject
- func (th *Thread) Cat(x, y Value) Value
- func (th *Thread) Close()
- func (th *Thread) Dbms() IDbms
- func (th *Thread) GetState() ThreadState
- func (th *Thread) Invalidate()
- func (th *Thread) Locals(i int) *SuObject
- func (th *Thread) Lookup(this Value, method string) Callable
- func (th *Thread) Pop() Value
- func (th *Thread) PrintStack()
- func (th *Thread) Push(x Value)
- func (th *Thread) PushCall(fn Callable, this Value, as *ArgSpec, args ...Value) Value
- func (th *Thread) Regex(x Value) regex.Pattern
- func (th *Thread) Reset()
- func (th *Thread) RestoreState(st ThreadState)
- func (th *Thread) RunWithMainSuneido(fn func() Value) Value
- func (th *Thread) Session() string
- func (th *Thread) SessionId(id string) string
- func (th *Thread) SetDbms(dbms IDbms)
- func (th *Thread) SetSession(s string)
- func (th *Thread) SetSviews(sv *Sviews)
- func (th *Thread) StartProfile()
- func (th *Thread) StopProfile() (total, self, ops, calls map[string]int32)
- func (th *Thread) SubThread() *Thread
- func (th *Thread) Sviews() *Sviews
- func (th *Thread) Swap()
- func (th *Thread) Timestamp() PackableValue
- func (th *Thread) Top() Value
- func (th *Thread) TrSet(x Value) tr.Set
- func (th *Thread) TraceCaller()
- func (th *Thread) TraceStack()
- type ThreadState
- type ToStringable
- type Value
- func GetBuiltinNames() []Value
- func InfoStr(name string) Value
- func IsConcurrent(x any) Value
- func NumFromString(s string) Value
- func OpAdd(x Value, y Value) Value
- func OpBitAnd(x Value, y Value) Value
- func OpBitNot(x Value) Value
- func OpBitOr(x Value, y Value) Value
- func OpBitXor(x Value, y Value) Value
- func OpCat(th *Thread, x, y Value) Value
- func OpDiv(x Value, y Value) Value
- func OpGt(x Value, y Value) Value
- func OpGte(x Value, y Value) Value
- func OpInRange(x Value, orgOp tok.Token, org Value, endOp tok.Token, end Value) Value
- func OpIs(x Value, y Value) Value
- func OpIsnt(x Value, y Value) Value
- func OpLeftShift(x Value, y Value) Value
- func OpLt(x Value, y Value) Value
- func OpLte(x Value, y Value) Value
- func OpMod(x Value, y Value) Value
- func OpMul(x Value, y Value) Value
- func OpNot(x Value) Value
- func OpRightShift(x Value, y Value) Value
- func OpSub(x Value, y Value) Value
- func OpUnaryMinus(x Value) Value
- func OpUnaryPlus(x Value) Value
- func Unpack(s string) Value
- func UnpackDate(s string) Value
- func UnpackNumber(s string) Value
- type ValueBase
- func (ValueBase[E]) AsStr() (string, bool)
- func (ValueBase[E]) Call(*Thread, Value, *ArgSpec) Value
- func (ValueBase[E]) Compare(Value) int
- func (ValueBase[E]) Get(*Thread, Value) Value
- func (ValueBase[E]) GetPut(*Thread, Value, Value, func(x, y Value) Value, bool) Value
- func (ValueBase[E]) Hash() uint32
- func (ValueBase[E]) Hash2() uint32
- func (ValueBase[E]) IfInt() (int, bool)
- func (ValueBase[E]) Lookup(*Thread, string) Callable
- func (ValueBase[E]) Put(*Thread, Value, Value)
- func (ValueBase[E]) RangeLen(int, int) Value
- func (ValueBase[E]) RangeTo(int, int) Value
- func (ValueBase[E]) SetConcurrent()
- func (ValueBase[E]) String() string
- func (ValueBase[E]) ToContainer() (Container, bool)
- func (ValueBase[E]) ToDnum() (dnum.Dnum, bool)
- func (ValueBase[E]) ToInt() (int, bool)
- func (ValueBase[E]) ToStr() (string, bool)
- func (ValueBase[E]) Type() types.Type
- func (ValueBase[E]) TypeName() string
- type ValueList
Examples ¶
Constants ¶
const ( EACH0 = 1 EACH1 = 2 )
values for ArgSpec.Each
const ( Sig0 byte = iota + 1 Sig1 Sig2 Sig3 Sig4 )
const ( AsEach = iota + 5 AsEach1 AsBlock )
const ( TsInitialBatch = 5 TsThreshold = 500 )
For timestamps with milliseconds up to TsThreshold, a client is allowed to increment the milliseconds TsInitialBatch times before requesting another timestamp. For timestamps with milliseconds >= TsThreshold, a client should use SuTimestamp incrementing extra. These values must match jSuneido.
const ( PackFalse = iota PackTrue PackMinus PackPlus PackString PackDate PackObject PackRecord )
Packed values start with one of the following type tags, except for the special case of a zero length string which is encoded as a zero length buffer. NOTE: this order is significant, it determines sorting
const E10 = uint64(1e10)
const E12 = uint64(1e12)
const E14 = uint64(1e14)
const E2 = uint64(1e2)
const E4 = uint64(1e4)
const E6 = uint64(1e6)
const E8 = uint64(1e8)
const GnSuneido = 1
const MaxArgs = 200
MaxArgs is the maximum number of arguments allowed
const MaxInstantiate = MaxSuInt
const MaxSuInt = math.MaxInt16
const MaxValues = 0x3fff
const MinSuInt = math.MinInt16
Variables ¶
var ArgSpec0 = ArgSpec{Nargs: 0, Signature: Sig0}
var ArgSpec1 = ArgSpec{Nargs: 1, Signature: Sig1}
var ArgSpec2 = ArgSpec{Nargs: 2, Signature: Sig2}
var ArgSpec3 = ArgSpec{Nargs: 3, Signature: Sig3}
var ArgSpec4 = ArgSpec{Nargs: 4, Signature: Sig4}
var ArgSpecBlock = ArgSpec{Nargs: 1, Spec: []byte{0}, Names: []Value{SuStr("block")}}
var ArgSpecEach0 = ArgSpec{Nargs: 1, Each: EACH0}
var ArgSpecEach1 = ArgSpec{Nargs: 1, Each: EACH1}
var BlockBreak = BuiltinSuExcept("block:break")
var BlockContinue = BuiltinSuExcept("block:continue")
var BlockReturn = BuiltinSuExcept("block return")
var DateBegin = NewDate(1700, 1, 1, 0, 0, 0, 0)
var DateEnd = NewDate(3000, 1, 1, 0, 0, 0, 0)
var DbmsAuth = false
var DefaultNewMethod = &SuBuiltin0{func() Value { return nil }, BuiltinParams{ParamSpec: ParamSpec0}}
var DefaultSingleQuotes = false
var EmptyObject = &SuObject{readonly: true}
EmptyObject is a readonly empty SuObject
var Exit func(code int)
Exit is injected by gSuneido
var GetDbms func() IDbms
GetDbms requires dependency injection
var Global typeGlobal
Global is used to group the global methods Would be cleaner to use a package but awkward dependencies. This approach doesn't seem to add any overhead.
var Interrupt func() bool // injected
Libload requires dependency injection
var LibraryOverrides = &libraryOverrides{ overrides: make(map[string]libOver), originals: make(map[string]Value)}
var LibsList atomics.Value[[]string]
LibsList is used by libload
var ParamSpec0 = ParamSpec{Nparams: 0, Signature: ^Sig0}
var ParamSpec1 = ParamSpec{Nparams: 1, Signature: ^Sig1}
var ParamSpec2 = ParamSpec{Nparams: 2, Signature: ^Sig2}
var ParamSpecAt = ParamSpec{Nparams: 1, Flags: []Flag{AtParam}}
var ParamSpecOptionalBlock = ParamSpec{Nparams: 1, Ndefaults: 1, Flags: []Flag{0}, Names: []string{"block"}, Values: []Value{False}}
var RunOnGoSide func() // injected
var StdArgSpecs = [...]ArgSpec{ ArgSpec0, ArgSpec1, ArgSpec2, ArgSpec3, ArgSpec4, ArgSpecEach0, ArgSpecEach1, ArgSpecBlock, }
Functions ¶
func AddInfo ¶
AddInfo registers a reference to a value. It is NOT thread-safe and should only be called during initialization. ref's should be thread-safe. The return type is to allow var _ = AddInfo("name", ref)
func AlertCancel ¶
func AsStr ¶
AsStr converts SuBool, SuInt, SuDnum, SuStr, SuConcat, SuExcept to string. Calls Value.AsStr and panics if it fails
func CompareSuTimestamp ¶
func CompareSuTimestamp(d1, d2 SuTimestamp) int
func Disasm ¶
func Disasm(fn *SuFunc, out outfn)
Disasm calls out for each disassembled byte code instruction in fn
func DisasmMixed ¶
DisasmMixed returns a listing of the source and its disassembled byte code
func EqualRows ¶
func EqualRows(hdr1 *Header, r1 Row, hdr2 *Header, r2 Row, cols []string, th *Thread, st *SuTran) bool
EqualRows is used by Compatible
func InstantiateMax ¶
func InstantiateMax(n int)
func LogInternalError ¶
LogInternalError logs the error and the call stacks, if an InternalError. It is used by dbmsserver
func LogUncaught ¶
func Pack ¶
Pack is a convenience function that packs a single Packable.
WARNING: It's possible to get a buffer overflow if a mutable value (e.g. object) is modified between/during PackSize and Pack.
func PackedCmpLower ¶
PackedCmpLower compares strings with str.CmpLower and other values with strings.Compare
func PackedToLower ¶
PackedToLower applies str.ToLower to packed strings. Other types of values are unchanged.
func PrintStack ¶
func PrintStack(cs *SuObject)
func Show ¶
Show is .String() plus for classes it shows their contents for functions it shows their parameters for containers it sorts by member
func SuInt ¶
func SuInt(n int) *smi
SuInt converts an int to *smi which implements Value will panic if out of int16 range
Example ¶
v := SuInt(123) fmt.Printf("%d %s\n", v.toInt(), v.String())
Output: 123 123
func SuIntToInt ¶
SuIntToInt converts to int if its argument is *smi
func ToDnum ¶
ToDnum converts false (SuBool), "" (SuStr), SuInt, SuDnum to Dnum. Calls Value.ToDnum and panics if it fails
func ToInt ¶
ToInt converts false (SuBool), "" (SuStr), SuInt, SuDnum to int. Calls Value.ToInt and panics if it fails
func ToStr ¶
ToStr converts SuStr, SuConcat, SuExcept to string. Calls Value.ToStr and panics if it fails
func ToStrOrString ¶
ToStrOrString returns either ToStr() or String() i.e. strings won't have quotes
Types ¶
type ActiveObserverList ¶
type ArgSpec ¶
type ArgSpec struct { // Spec has one entry per named argument, indexing into Names Spec []byte // Names is the argument names from the calling function Names []Value // Nargs is the number of values on the stack. // Because of @args (each) it may not be the actual number of arguments. Nargs byte // Each is 1 for @args, 2 for @+1args, 0 otherwise Each byte // Signature is used for fast matching of simple Argspec to ParamSpec Signature byte }
ArgSpec describes the arguments on the stack for a call See also ParamSpec
type ArgsIter ¶
func NewArgsIter ¶
NewArgsIter returns an iterator function that can be called to return successive name,value pairs with name = nil for unnamed values It returns nil,nil when there are no more values
type BuiltinParams ¶
type BuiltinParams struct {
ParamSpec
}
func (*BuiltinParams) String ¶
func (ps *BuiltinParams) String() string
func (*BuiltinParams) Type ¶
func (*BuiltinParams) Type() types.Type
type Callable ¶
Callable is returned by Lookup
type Container ¶
type Container interface { Value Add(val Value) ListSize() int ListGet(i int) Value NamedSize() int Copy() Container Slice(n int) Container DeleteAll() Insert(at int, val Value) Erase(th *Thread, key Value) bool Delete(th *Thread, key Value) bool GetIfPresent(th *Thread, key Value) Value IsReadOnly() bool SetReadOnly() ArgsIter() func() (Value, Value) Iter2(list bool, named bool) func() (Value, Value) HasKey(key Value) bool ToObject() *SuObject ToRecord(th *Thread, hdr *Header) Record IsConcurrent() Value }
Container is an interface to objects and records
func ToContainer ¶
ToContainer converts to a Container or panics
type Displayable ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is the context for a function/method/block invocation.
type Header ¶
type Header struct { // Fields is the physical fields, including deleted ("-") Fields [][]string // Columns is the logical fields Columns []string // contains filtered or unexported fields }
Header specifies the fields (physical) and columns (logical) for a query
func JoinHeaders ¶
JoinHeaders appends the fields, and unions the columns. It is used by Join and Union. WARNING: if field on one and rule on the other, the result will look like it's a field. See also: Header.Rules
func SimpleHeader ¶
func (*Header) AppendDerived ¶
func (*Header) GetFields ¶
GetFields returns a list of the fields, including deleted ("-"), without duplicates (e.g. from Join or Union)
func (*Header) HasDeleted ¶
type ICursor ¶
type ICursor interface { IQueryCursor // Get returns the next or previous row from a cursor // and its table if the query is updateable Get(th *Thread, tran ITran, dir Dir) (Row, string) }
ICursor is the interface to a database query, either local or client
type IDbms ¶
type IDbms interface { // Admin executes a schema change (create, alter, drop) Admin(string, *Sviews) // Auth authorizes the connection with the server Auth(*Thread, string) bool // Check checks the database like -check // It returns "" or an error message. Check() string // Close ends a dbms connection Close() // Connections returns a list of the current server connections Connections() Value // Cursor is like a query but independent of any one transaction Cursor(query string, sv *Sviews) ICursor // Cursors returns the current number of cursors Cursors() int DisableTrigger(table string) EnableTrigger(table string) // Exec is used by the new style ServerEval(...) Exec(th *Thread, args Value) Value // Final returns the current number of final transactions Final() int // Get returns a single record, for Query1 (dir = One), // QueryFirst (dir = Next), or QueryLast (dir = Prev) Get(th *Thread, query string, dir Dir) (Row, *Header, string) // Info returns an object containing database information Info() Value // Kill terminates connections with the given session id. // It returns the count of connections ended. Kill(string) int // LibGet returns a list of definitions for name // alternating library name and definition // in Libraries() order LibGet(name string) []string // Libraries returns a list of the libraries currently in use Libraries() []string // Log writes to the server's error.log Log(string) // Nonce returns a random string from the server Nonce(*Thread) string // Run is used by the old style string.ServerEval() Run(th *Thread, code string) Value Schema(table string) string // SessionId sets and/or returns the session id for the current connection SessionId(th *Thread, id string) string // Size returns the current database size Size() uint64 // Timestamp returns a guaranteed unique date/time Timestamp() SuDate // Token returns data to use with Auth Token() string // Transaction starts a transaction Transaction(update bool) ITran // Transactions returns a list of the outstanding transactions Transactions() *SuObject // Use removes a library from those in use Unuse(lib string) bool // Use adds a library to those in use Use(lib string) bool // Unwrap removes DbmsUnauth if DbmsAuth Unwrap() IDbms }
IDbms is the interface to the dbms package. The two implementations, DbmsLocal and DbmsClient, are in the dbms package
type IQuery ¶
type IQuery interface { IQueryCursor // Get returns the next or previous row from a query // and its table if the query is updateable Get(th *Thread, dir Dir) (Row, string) // Output outputs a record to a query Output(th *Thread, rec Record) }
IQuery is the interface to a database query, either local or client
type IQueryCursor ¶
type IQueryCursor interface { // Close ends a query Close() // Header returns the header (columns and fields) for the query Header() *Header // Keys returns the keys for the query (a list of comma separated strings) Keys() []string // Order returns the order for the query (a list of columns) Order() []string // Rewind resets the query to the beginning/end Rewind() // Strategy returns a description of the optimized query Strategy(formatted bool) string }
type ISuQueryCursor ¶
type ISuQueryCursor interface { Close() Columns() Value Keys() Value Order() Value Rewind() RuleColumns() Value Strategy(formatted bool) Value }
ISuQueryCursor is the common interface to SuQuery and SuCursor
type ITran ¶
type ITran interface { String() string // Abort rolls back the transaction Abort() string // Complete commits the transaction. // It returns "" on success, otherwise the conflict. Complete() string // Delete deletes a record Delete(th *Thread, table string, off uint64) // Get returns a single record, for Query1 (dir = One), // QueryFirst (dir = Next), or QueryLast (dir = Prev) Get(th *Thread, query string, dir Dir) (Row, *Header, string) // Query starts a query Query(query string, sv *Sviews) IQuery // Action executes an insert, update, or delete // and returns the number of records processed Action(th *Thread, action string) int // Update modifies a record Update(th *Thread, table string, off uint64, rec Record) uint64 // ReadCount returns the number of reads done by the transaction ReadCount() int // WriteCount returns the number of writes done by the transaction WriteCount() int // Asof sets the date-time for the transaction if asof is non-zero, // and returns the date-time for the transaction, // with the date-times as unix milli Asof(int64) int64 Num() int }
ITran is the interface to a dbms transaction, either local (not implemented yet) or TranClient.
type Iter ¶
type Iter interface { // Next returns nil when there are no more values Next() Value // Dup returns a copy of this Iter that starts at the beginning Dup() Iter Infinite() bool SetConcurrent() IsConcurrent() Value Instantiate() *SuObject }
Iter is the internal type for iterators. See also: SuIter and wrapIter.
func IterAssocs ¶
func IterMembers ¶
func IterValues ¶
type MayLock ¶
type MayLock struct {
// contains filtered or unexported fields
}
MayLock can be embedded to provide locking. concurrent is set *before* an object is shared and doesn't change after that so it should not require atomic or locked access. Before concurrent is set, no locking is done.
func (*MayLock) IsConcurrent ¶
func (*MayLock) SetConcurrent ¶
func (x *MayLock) SetConcurrent()
type MemBase ¶
MemBase is the shared base for SuClass and SuInstance
func NewMemBase ¶
func NewMemBase() MemBase
func (*MemBase) AddMembersTo ¶
type Methods ¶
Methods is a map of method name strings to Values
var BaseMethods Methods
BaseMethods is initialized by the builtin package
var ClassMethods Methods
ClassMethods is initialized by the builtin package
var CursorMethods Methods
CursorMethods is initialized by the builtin package
var DateMethods Methods
DateMethods is initialized by the builtin package
var InstanceMethods Methods
InstanceMethods is initialized by the builtin package
var IntMethods Methods
IntMethods is initialized by the builtin package
var IterMethods Methods
IterMethods is set by builtin/iter.go
var NumMethods Methods
NumMethods is initialized by the builtin package
var ObjectMethods Methods
ObjectMethods is initialized by the builtin package
var ParamsMethods Methods
ParamsMethods is initialized by the builtin package
var QueryMethods Methods
QueryMethods is initialized by the builtin package
var RecordMethods Methods
RecordMethods is initialized by the builtin package
var RegexMethods Methods
RegexMethods is initialized by the builtin package
var SequenceMethods Methods
SequenceMethods is initialized by the builtin package
var StringMethods Methods
StringMethods is initialized by the builtin package
var SuExceptMethods Methods
SuExceptMethods is initialized by the builtin package
var SuFuncMethods Methods
SuFuncMethods is initialized by the builtin package
var SuneidoObjectMethods Methods
SuneidoObjectMethods is initialized by builtin/suneido.go
var TranMethods Methods
TranMethods is initialized by the builtin package
type Packable ¶
type Packable interface { // PackSize returns the size (in bytes) of the packed value. // object/record set hash to detect nested changes. PackSize(hash *uint32) int // PackSize2 is used by object/record to handle nesting PackSize2(hash *uint32, stack packStack) int // Pack appends the value to the Encoder Pack(hash *uint32, buf *pack.Encoder) }
Packable is the interface to packable values PackSize should be called prior to Pack since Pack methods assume capacity is sufficient and because PackSize does nesting limit check
type PackableValue ¶
func DateFromLiteral ¶
func DateFromLiteral(s string) PackableValue
DateFromLiteral returns an SuDate or an SuTimestamp from the Suneido literal format yyyymmdd[.hhmm[ss[mmm[ccc]]]] It returns NilDate if the string is invalid.
func Int64Val ¶
func Int64Val(n int64) PackableValue
Int64Val returns an SuInt if it fits, else a SuDnum
type ParamSpec ¶
type ParamSpec struct { ValueBase[sufunction] // Lib is the library that the function came from Lib string // Name for library records will be the record name; // for class methods, the method name; // if assigned to a local variable, the variable name. // It is primarily for debugging, i.e. call stack traces. // See also: Name(value) builtin function Name string // Values contains any literals in the function // starting with parameter defaults Values []Value // Flags specifies "types" of params Flags []Flag // Names normally starts with the parameters, followed by local variables Names []string // Nparams is the number of arguments required on the stack Nparams uint8 // NDefaults is the number of default values for parameters // They are in the start of Values Ndefaults uint8 // Offset is the location of the parameter names within Names // and the arguments within Locals // It is used for closure blocks, for normal functions it is 0 // Offset is only required for parameters (or arguments), // it is not needed for local variables Offset uint8 // Signature is used for fast matching of simple Argspec to ParamSpec Signature byte }
ParamSpec describes the parameters of a function See also ArgSpec which describes the arguments of a function call It also serves as the basis for callables like SuFunc
func (ParamSpec) SetConcurrent ¶
func (ParamSpec) SetConcurrent()
type Record ¶
type Record string
Record is an immutable record stored in a string using the same format as cSuneido and jSuneido.
NOTE: This is the post 2019 format using a two byte header.
It is used for storing data records in the database and in dumps and for transferring data records across the client-server protocol.
An empty Record is a single zero byte.
First two bytes are the type and the count of values, high two bits are the type followed by the total length (uint8, uint16, or uint32) followed by the offsets of the fields (uint8, uint16, or uint32) followed by the contents of the fields integers are stored big endian (most significant first)
type RecordBuilder ¶
type RecordBuilder struct {
// contains filtered or unexported fields
}
RecordBuilder is used to construct records. Zero value is ready to use.
func (*RecordBuilder) Add ¶
func (b *RecordBuilder) Add(p Packable) *RecordBuilder
Add appends a Packable
func (*RecordBuilder) AddRaw ¶
func (b *RecordBuilder) AddRaw(s string) *RecordBuilder
AddRaw appends a string containing an already packed value
func (*RecordBuilder) Build ¶
func (b *RecordBuilder) Build() Record
func (*RecordBuilder) Trim ¶
func (b *RecordBuilder) Trim() *RecordBuilder
Trim removes trailing empty fields
type Row ¶
type Row []DbRec
Row is the result of database queries. It is a list of DbRec so that operations e.g. join can avoid building new records.
func (Row) GetRawVal ¶
GetRawVal is like GetVal (i.e. handles rules) but returns a raw/packed value.
type SuBool ¶
type SuBool bool
SuBool is a boolean Value
func (SuBool) SetConcurrent ¶
func (SuBool) SetConcurrent()
func (SuBool) ToContainer ¶
type SuBuiltin ¶
type SuBuiltin struct { Fn func(th *Thread, args []Value) Value BuiltinParams }
SuBuiltin is a Value for a built in function
type SuBuiltin0 ¶
type SuBuiltin0 struct { Fn func() Value BuiltinParams }
SuBuiltin0 is a Value for a builtin function with no arguments
type SuBuiltin1 ¶
type SuBuiltin1 struct { Fn func(a1 Value) Value BuiltinParams }
SuBuiltin1 is a Value for a builtin function with one argument
type SuBuiltin2 ¶
type SuBuiltin2 struct { Fn func(a1, a2 Value) Value BuiltinParams }
SuBuiltin2 is a Value for a builtin function with two arguments
type SuBuiltin3 ¶
type SuBuiltin3 struct { Fn func(a1, a2, a3 Value) Value BuiltinParams }
SuBuiltin3 is a Value for a builtin function with three arguments
type SuBuiltin4 ¶
type SuBuiltin4 struct { Fn func(a1, a2, a3, a4 Value) Value BuiltinParams }
SuBuiltin4 is a Value for a builtin function with four arguments
type SuBuiltin5 ¶
type SuBuiltin5 struct { Fn func(a1, a2, a3, a4, a5 Value) Value BuiltinParams }
SuBuiltin5 is a Value for a builtin function with five arguments
type SuBuiltin6 ¶
type SuBuiltin6 struct { Fn func(a1, a2, a3, a4, a5, a6 Value) Value BuiltinParams }
SuBuiltin6 is a Value for a builtin function with six arguments
type SuBuiltin7 ¶
type SuBuiltin7 struct { Fn func(a1, a2, a3, a4, a5, a6, a7 Value) Value BuiltinParams }
type SuBuiltinMethod ¶
type SuBuiltinMethod struct { Fn func(th *Thread, this Value, args []Value) Value BuiltinParams }
SuBuiltinMethod is a Callable for a builtin method
type SuBuiltinMethod0 ¶
type SuBuiltinMethod0 struct {
SuBuiltin1
}
SuBuiltinMethod0 is a Callable for a builtin method with no arguments
type SuBuiltinMethod1 ¶
type SuBuiltinMethod1 struct {
SuBuiltin2
}
SuBuiltinMethod1 is a Callable for a builtin method with one argument
type SuBuiltinMethod2 ¶
type SuBuiltinMethod2 struct {
SuBuiltin3
}
SuBuiltinMethod2 is a Callable for a builtin method with two arguments
type SuBuiltinMethod3 ¶
type SuBuiltinMethod3 struct {
SuBuiltin4
}
SuBuiltinMethod3 is a Callable for a builtin method with two arguments
type SuBuiltinMethodRaw ¶
type SuBuiltinMethodRaw struct { Fn func(th *Thread, as *ArgSpec, this Value, args []Value) Value ParamSpec }
SuBuiltinMethodRaw is a Callable for a builtin function with no massage
func (*SuBuiltinMethodRaw) Call ¶
func (b *SuBuiltinMethodRaw) Call(th *Thread, this Value, as *ArgSpec) Value
func (*SuBuiltinMethodRaw) Type ¶
func (b *SuBuiltinMethodRaw) Type() types.Type
type SuBuiltinRaw ¶
type SuBuiltinRaw struct { Fn func(th *Thread, as *ArgSpec, args []Value) Value BuiltinParams }
SuBuiltinRaw is a Value for a builtin function with no massage
type SuClass ¶
type SuClass struct { ValueBase[*SuClass] Lib string Name string MemBase Base Gnum // contains filtered or unexported fields }
SuClass is a user defined (Suneido language) class. Classes are read-only so there is no locking.
func (*SuClass) GetParents ¶
func (*SuClass) IsConcurrent ¶
func (*SuClass) SetConcurrent ¶
func (*SuClass) SetConcurrent()
func (*SuClass) SetParents ¶
func (*SuClass) StartCoverage ¶
func (*SuClass) StopCoverage ¶
type SuClosure ¶
type SuClosure struct { SuFunc // contains filtered or unexported fields }
SuClosure is an instance of a closure block
func (*SuClosure) IsConcurrent ¶
func (*SuClosure) SetConcurrent ¶
func (b *SuClosure) SetConcurrent()
type SuConcat ¶
SuConcat is a Value used to optimize string concatenation WARNING: zero value is not valid, use NewSuConcat
func (SuConcat) IsConcurrent ¶
func (SuConcat) SetConcurrent ¶
func (c SuConcat) SetConcurrent()
type SuCursor ¶
type SuCursor struct { ValueBase[SuCursor] SuQueryCursor }
func (*SuCursor) SetConcurrent ¶
func (*SuCursor) SetConcurrent()
type SuDate ¶
SuDate is a Suneido date/time Value
Represents a readable "local" date and time. Does not take into account time zones or daylight savings.
It is designed to be efficient to pack and unpack and to convert to human readable formats. (Calculations are less common.)
var NilDate SuDate
func FromGoTime ¶
func NormalizeDate ¶
func SuDateFromUnixMilli ¶
func (SuDate) Millisecond ¶
func (SuDate) MinusMs ¶
MinusMs returns the difference between two Dates in milliseconds
WARNING: doing this around daylight savings changes may be problematic
func (SuDate) SetConcurrent ¶
func (SuDate) SetConcurrent()
type SuDnum ¶
SuDnum wraps a Dnum and implements Value and Packable
func (SuDnum) SetConcurrent ¶
func (SuDnum) SetConcurrent()
type SuExcept ¶
func BuiltinSuExcept ¶
BuiltinSuExcept is for special values for block break, continue, return
func NewSuExcept ¶
func ToSuExcept ¶
ToSuExcept converts to SuExcept, and also logs runtime and assert errors
func (*SuExcept) SetConcurrent ¶
func (e *SuExcept) SetConcurrent()
type SuFunc ¶
type SuFunc struct { // Code is the actual byte code Code string // ClassName is used to privatize dot params ClassName string // SrcPos contains pairs of source and code position deltas SrcPos string // ArgSpecs used by calls in the code ArgSpecs []ArgSpec ParamSpec // SrcBase is the starting point for the SrcPos source deltas SrcBase int // Nlocals is the number of parameters and local variables Nlocals uint8 IsBlock bool // contains filtered or unexported fields }
SuFunc is a compiled Suneido function, method, or block
func (*SuFunc) CodeToSrcPos ¶
func (*SuFunc) StartCoverage ¶
func (*SuFunc) StopCoverage ¶
type SuInstance ¶
type SuInstance struct { ValueBase[*SuInstance] MemBase // contains filtered or unexported fields }
SuInstance is an instance of an SuClass
func NewInstance ¶
func NewInstance(th *Thread, class *SuClass) *SuInstance
func (*SuInstance) Base ¶
func (ob *SuInstance) Base() *SuClass
func (*SuInstance) Clear ¶
func (ob *SuInstance) Clear()
func (*SuInstance) Copy ¶
func (ob *SuInstance) Copy() *SuInstance
func (*SuInstance) Delete ¶
func (ob *SuInstance) Delete(key Value)
func (*SuInstance) Equal ¶
func (ob *SuInstance) Equal(other any) bool
Equal uses deepEqual if both instances have UseDeepEquals, otherwise it uses reference/pointer equality like Same?
func (*SuInstance) SetConcurrent ¶
func (ob *SuInstance) SetConcurrent()
func (*SuInstance) String ¶
func (ob *SuInstance) String() string
func (*SuInstance) ToString ¶
func (ob *SuInstance) ToString(th *Thread) string
ToString is used by Cat, Display, and Print to handle user defined ToString
func (*SuInstance) Type ¶
func (*SuInstance) Type() types.Type
type SuIter ¶
SuIter is a Value that wraps a runtime.Iter and provides the Suneido interator interface (Next,Dup,Infinite) returning itself when it reaches the end
func (SuIter) IsConcurrent ¶
func (SuIter) SetConcurrent ¶
func (it SuIter) SetConcurrent()
type SuMethod ¶
SuMethod is a bound method originating from an SuClass or SuInstance when called, it sets 'this' to the origin
func NewSuMethod ¶
func (*SuMethod) SetConcurrent ¶
func (m *SuMethod) SetConcurrent()
type SuObject ¶
SuObject is a Suneido object i.e. a container with both list and named members. Zero value is a valid empty object.
func InstantiateIter ¶
func NewSuObject ¶
NewSuObject creates an SuObject from a slice of Value's
func SuObjectOf ¶
SuObjectOf returns an SuObject from its arguments
func SuObjectOfArgs ¶
SuObjectOfArgs is used by massage and lrucache
func SuObjectOfStrs ¶
SuObjectOfStrs returns an SuObject from a slice of strings
func UnpackObject ¶
func (*SuObject) BinarySearch ¶
BinarySearch does a binary search with default comparisons
func (*SuObject) BinarySearch2 ¶
BinarySearch2 does a binary search with a user specified less than function
func (*SuObject) Delete ¶
Delete removes a key. If in the list, following list values are shifted over.
func (*SuObject) DeleteAll ¶
func (ob *SuObject) DeleteAll()
DeleteAll removes all the contents of the object, making it empty (size 0)
func (*SuObject) Erase ¶
Erase removes a key. If in the list, following list values are NOT shifted over.
func (*SuObject) Find ¶
Find returns the key of the first occurrence of the value else False. Lock to avoid object-modified-during-iteration.
func (*SuObject) Insert ¶
Insert inserts at the given position. If the position is within the list, following values are moved over.
func (*SuObject) IsConcurrent ¶
func (*SuObject) IsReadOnly ¶
func (*SuObject) Iter2 ¶
Iter2 iterates through list and named elements. List elements are returned with their numeric key index.
func (*SuObject) Put ¶
Put adds or updates the given key and value The value will be added to the list if the key is the "next"
func (*SuObject) Set ¶
Set implements Put, doesn't require thread. The value will be added to the list if the key is the "next"
func (*SuObject) SetChildConc ¶
func (ob *SuObject) SetChildConc()
func (*SuObject) SetConcurrent ¶
func (ob *SuObject) SetConcurrent()
SetConcurrent when readonly does not need to set shouldLock. But it still needs to set its children to concurrent because they may be SuRecords that require locking when readonly or other objects that require copyCount initialization.
func (*SuObject) SetDefault ¶
func (*SuObject) SetReadOnly ¶
func (ob *SuObject) SetReadOnly()
func (*SuObject) Show ¶
Show is like Display except that it sorts named members. It is used for tests.
func (*SuObject) ToContainer ¶
type SuQuery ¶
type SuQuery struct { ValueBase[SuQuery] SuQueryCursor // contains filtered or unexported fields }
func (*SuQuery) SetConcurrent ¶
func (*SuQuery) SetConcurrent()
type SuQueryCursor ¶
type SuQueryCursor struct {
// contains filtered or unexported fields
}
SuQueryCursor is the common base for SuQuery and SuCursor
func (*SuQueryCursor) Close ¶
func (qc *SuQueryCursor) Close()
func (*SuQueryCursor) Columns ¶
func (qc *SuQueryCursor) Columns() Value
func (*SuQueryCursor) Keys ¶
func (qc *SuQueryCursor) Keys() Value
func (*SuQueryCursor) Order ¶
func (qc *SuQueryCursor) Order() Value
func (*SuQueryCursor) Rewind ¶
func (qc *SuQueryCursor) Rewind()
func (*SuQueryCursor) RuleColumns ¶
func (qc *SuQueryCursor) RuleColumns() Value
func (*SuQueryCursor) Strategy ¶
func (qc *SuQueryCursor) Strategy(formatted bool) Value
type SuRecord ¶
SuRecord is an SuObject with observers and rules and a default value of "". Uses the lock from SuObject. Use NewSuRecord since zero value doesn't set default.
func NewSuRecord ¶
func NewSuRecord() *SuRecord
func SuRecordFromObject ¶
SuRecordFromObject creates a record from an arguments object WARNING: it does not copy the data, the original object should be discarded
func SuRecordFromRow ¶
func UnpackRecord ¶
func (*SuRecord) AttachRule ¶
func (*SuRecord) GetIfPresent ¶
GetIfPresent is the same as Get except it returns nil instead of defval for missing members
func (*SuRecord) Invalidate ¶
func (*SuRecord) IsConcurrent ¶
func (*SuRecord) IsReadOnly ¶
func (*SuRecord) RemoveObserver ¶
func (*SuRecord) SetConcurrent ¶
func (r *SuRecord) SetConcurrent()
SetConcurrent for SuRecord differs from SuObject. Unlike SuObject, SuRecord needs to lock when readonly because it modifies dependents and hdr's cache etc.
func (*SuRecord) SetReadOnly ¶
func (r *SuRecord) SetReadOnly()
func (*SuRecord) ToContainer ¶
func (*SuRecord) ToRecord ¶
ToRecord converts this SuRecord to a Record to be stored in the database
func (*SuRecord) Transaction ¶
type SuRegex ¶
SuRegex is a compiled regular expression. It is not a general purpose Value and is internal, not exposed.
func (SuRegex) SetConcurrent ¶
func (SuRegex) SetConcurrent()
type SuSequence ¶
type SuSequence struct { ValueBase[SuSequence] MayLock // contains filtered or unexported fields }
SuSequence wraps an Iter and instantiates it lazily the Iter is either built-in e.g. Seq or object.Members, or user defined via Sequence
func NewSuSequence ¶
func NewSuSequence(it Iter) *SuSequence
func (*SuSequence) Compare ¶
func (seq *SuSequence) Compare(other Value) int
func (*SuSequence) Copy ¶
func (seq *SuSequence) Copy() Value
func (*SuSequence) Equal ¶
func (seq *SuSequence) Equal(other any) bool
func (*SuSequence) Hash ¶
func (seq *SuSequence) Hash() uint32
func (*SuSequence) Hash2 ¶
func (seq *SuSequence) Hash2() uint32
func (*SuSequence) Infinite ¶
func (seq *SuSequence) Infinite() bool
func (*SuSequence) Instantiated ¶
func (seq *SuSequence) Instantiated() bool
func (*SuSequence) Iter ¶
func (seq *SuSequence) Iter() Iter
func (*SuSequence) PackSize ¶
func (seq *SuSequence) PackSize(hash *uint32) int
func (*SuSequence) PackSize2 ¶
func (seq *SuSequence) PackSize2(hash *uint32, stack packStack) int
func (*SuSequence) SetConcurrent ¶
func (seq *SuSequence) SetConcurrent()
func (*SuSequence) String ¶
func (seq *SuSequence) String() string
func (*SuSequence) ToContainer ¶
func (seq *SuSequence) ToContainer() (Container, bool)
func (*SuSequence) Type ¶
func (*SuSequence) Type() types.Type
type SuStr ¶
type SuStr string
SuStr is a string Value
func (SuStr) SetConcurrent ¶
func (SuStr) SetConcurrent()
func (SuStr) ToContainer ¶
type SuTimestamp ¶
type SuTimestamp struct { SuDate // contains filtered or unexported fields }
SuTimestamp is an extension of SuDate that adds an extra byte of precision for timestamps.
func UnpackTimestamp ¶
func UnpackTimestamp(sd SuDate, d *pack.Decoder) SuTimestamp
func (SuTimestamp) Compare ¶
func (d SuTimestamp) Compare(other Value) int
func (SuTimestamp) Equal ¶
func (d SuTimestamp) Equal(other any) bool
func (SuTimestamp) Hash ¶
func (d SuTimestamp) Hash() uint32
func (SuTimestamp) PackSize ¶
func (SuTimestamp) PackSize(*uint32) int
func (SuTimestamp) PackSize2 ¶
func (SuTimestamp) PackSize2(*uint32, packStack) int
func (SuTimestamp) String ¶
func (d SuTimestamp) String() string
type SuTran ¶
type SuTran struct { ValueBase[*suTransaction] // contains filtered or unexported fields }
SuTran is a database transaction
func (*SuTran) SetConcurrent ¶
func (st *SuTran) SetConcurrent()
func (*SuTran) WriteCount ¶
type SuneidoObject ¶
type SuneidoObject struct {
SuObject
}
SuneidoObject is the global Suneido object. It is a separate type to allow Suneido.Parse and Suneido.Compile methods.
var Suneido *SuneidoObject
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
var MainThread *Thread
MainThread is injected by gsuneido.go to use for debugging
func NewThread ¶
NewThread creates a new thread. It is primarily used for user initiated threads. Internal threads can just use a zero Thread.
func (*Thread) CallLookup ¶
CallLookup calls a *named* method.
func (*Thread) CallLookupEach1 ¶
func (*Thread) Close ¶
func (th *Thread) Close()
Close closes the thread's dbms connection (if it has one)
func (*Thread) GetState ¶
func (th *Thread) GetState() ThreadState
func (*Thread) Invalidate ¶
func (th *Thread) Invalidate()
Invalidate is used by workers to help detect use of thread after request
func (*Thread) PrintStack ¶
func (th *Thread) PrintStack()
PrintStack outputs the thread's call stack to stderr
func (*Thread) Reset ¶
func (th *Thread) Reset()
Reset clears the thread except for Num, Name, session, and dbms. It is used by the repl and by dbms server workers.
func (*Thread) RestoreState ¶
func (th *Thread) RestoreState(st ThreadState)
func (*Thread) RunWithMainSuneido ¶
func (*Thread) SetSession ¶
func (*Thread) StartProfile ¶
func (th *Thread) StartProfile()
func (*Thread) StopProfile ¶
func (*Thread) SubThread ¶
SubThread is a NewThread with the same dbms as this thread. This is used for SuneidoAPP threads. We want a new thread for isolation e.g. for exceptions or dynamic variables but we don't need the overhead of another dbms connection. WARNING: This should only be used where it is guaranteed that the Threads will NOT be used concurrently.
func (*Thread) Timestamp ¶
func (th *Thread) Timestamp() PackableValue
Timestamp is a Thread method for convenience, so it has access to the dbms. It is not "per thread". This is the "client" version of Timestamp.
func (*Thread) TraceCaller ¶
func (th *Thread) TraceCaller()
func (*Thread) TraceStack ¶
func (th *Thread) TraceStack()
TraceStack outputs the thread's call stack to trace
type ThreadState ¶
type ThreadState struct {
// contains filtered or unexported fields
}
type ToStringable ¶
type Value ¶
type Value interface { // String returns a human readable string i.e. Suneido Display // Note: strings will have quotes and be escaped String() string // AsStr converts SuBool, SuInt, SuDnum, SuStr, SuConcat, SuExcept to string AsStr() (string, bool) // ToStr converts SuStr, SuConcat, SuExcept to string ToStr() (string, bool) // ToInt converts false (SuBool), "" (SuStr), SuInt, SuDnum to int ToInt() (int, bool) // IfInt converts SuInt, SuDnum to int IfInt() (int, bool) // ToDnum converts false (SuBool), "" (SuStr), SuInt, SuDnum to Dnum ToDnum() (dnum.Dnum, bool) // ToContainer converts object,record,sequence to a Container ToContainer() (Container, bool) // Get returns a member of an object/instance/class or a character of a string // returns nil if the member does not exist // The thread is necessary to call getters Get(th *Thread, key Value) Value // Put sets its key member to val. // Implemented by SuObject, SuRecord, and SuInstance. // t is required by SuRecord to call observers. Put(th *Thread, key Value, val Value) // GetPut is used for update operations like += and ++ atomically GetPut(th *Thread, key Value, val Value, op func(x, y Value) Value, retOrig bool) Value RangeTo(i int, j int) Value RangeLen(i int, n int) Value Equal(other any) bool Hash() uint32 // Hash2 is used by object to shallow hash contents Hash2() uint32 // Type returns the Suneido name for the type Type() types.Type // Compare returns -1 for less, 0 for equal, +1 for greater Compare(other Value) int Callable // Lookup returns a Callable or nil if the method isn't found Lookup(th *Thread, method string) Callable // SetConcurrent is called when a Value is // about to become reachable by multiple threads. // At the point where SetConcurrent is called it is still thread contained. // SetConcurrent should be called on any other Value's reachable from this. // Additional calls to SetConcurrent should be ignored. // NOTE: SetConcurrent cannot call abitrary code // because it is called when holding a lock. SetConcurrent() }
Value is a value visible to Suneido programmers The naming convention is to use a prefix of "Su" - SuBoolean - SuInt, SuDnum - numbers - SuStr, SuConcat, SuExcept - strings - SuDate - SuObject, SuRecord, SuSequence - objects - SuBuiltin*, SuBuiltinMethod* - SuFunc - SuClosure - SuClass - SuInstance - SuMethod - not directly accessible, but returned for bound methods - SuIter - not directly accessible, but returned from e.g. object.Iter
var NilVal Value
func GetBuiltinNames ¶
func GetBuiltinNames() []Value
func IsConcurrent ¶
func NumFromString ¶
NumFromString converts a string to an SuInt or SuDnum. It will panic for invalid input.
func OpLeftShift ¶
func OpRightShift ¶
func OpUnaryMinus ¶
func OpUnaryPlus ¶
func UnpackDate ¶
UnpackDate unpacks a date from the supplied byte slice
func UnpackNumber ¶
type ValueBase ¶
type ValueBase[E any] struct{}
ValueBase is embedded in Value types to supply default methods. The parameter type is only used to get a type name for errors.
func (ValueBase[E]) SetConcurrent ¶
func (ValueBase[E]) SetConcurrent()
func (ValueBase[E]) ToContainer ¶
Source Files ¶
- alert_port.go
- args.go
- argsiter.go
- argspec.go
- call.go
- container.go
- deepequal.go
- disasm.go
- fatal.go
- frame.go
- globals.go
- idbms.go
- info.go
- interp.go
- iter.go
- libover.go
- membase.go
- ops.go
- pack.go
- paramspec.go
- port.go
- print.go
- profile.go
- record.go
- row.go
- subool.go
- subuiltin.go
- suclass.go
- suclosure.go
- suconcat.go
- sudate.go
- sudnum.go
- suexcept.go
- sufunc.go
- suinstance.go
- suint.go
- suiter.go
- sumethod.go
- suneido.go
- suobject.go
- suquery.go
- surecord.go
- suregex.go
- susequence.go
- sustr.go
- sutimestamp.go
- sutran.go
- sviews.go
- thread.go
- value.go
- valuebase.go
- warning.go
- withtype.go