Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Add = &turing.Operator{ Name: "turing/Add", Zero: []byte("0"), Apply: func(value []byte, ops [][]byte) ([]byte, turing.Ref, error) { count, _ := strconv.ParseInt(cast.ToString(value), 10, 64) for _, op := range ops { increment, _ := strconv.ParseInt(cast.ToString(op), 10, 64) count += increment } buf, ref := fpack.Borrow(int64Len) buf = buf[:0] buf = strconv.AppendInt(buf, count, 10) return buf, ref, nil }, Combine: func(ops [][]byte) ([]byte, turing.Ref, error) { // apply operands var count int64 for _, op := range ops { increment, _ := strconv.ParseInt(cast.ToString(op), 10, 64) count += increment } buf, ref := fpack.Borrow(int64Len) buf = buf[:0] buf = strconv.AppendInt(buf, count, 10) return buf, ref, nil }, }
Add is an operator used by Inc to add together numerical values.
Functions ¶
This section is empty.
Types ¶
type Dump ¶
Dump will dump all key value pairs.
func (*Dump) Describe ¶
func (d *Dump) Describe() *turing.Description
Describe implements the turing.Instruction interface.
type Get ¶
Get will get a value.
func (*Get) Describe ¶
func (g *Get) Describe() *turing.Description
Describe implements the turing.Instruction interface.
type Inc ¶
Inc will increment an numerical value.
func (*Inc) Describe ¶
func (i *Inc) Describe() *turing.Description
Describe implements the turing.Instruction interface.
type List ¶
List will list all keys.
func (*List) Describe ¶
func (l *List) Describe() *turing.Description
Describe implements the turing.Instruction interface.
type Set ¶
Set will set a value.
func (*Set) Describe ¶
func (s *Set) Describe() *turing.Description
Describe implements the turing.Instruction interface.
Click to show internal directories.
Click to hide internal directories.