Documentation
¶
Overview ¶
Package ops writes a commit's operations as JSON for a host that draws them: an array of arrays, each led by its code and the view's ID. It is written by hand, as a batch is built at every commit and reflection would weigh on the host's size and time.
Index ¶
- func AppendNum(b []byte, v float64) []byte
- func AppendString(b []byte, s string) []byte
- type Object
- type Writer
- func (w *Writer) Bool(v bool) *Writer
- func (w *Writer) Bytes() []byte
- func (w *Writer) Empty() bool
- func (w *Writer) Null() *Writer
- func (w *Writer) Num(v float64) *Writer
- func (w *Writer) Op(code string, id driver.NodeID) *Writer
- func (w *Writer) Pt(v driver.Points) *Writer
- func (w *Writer) Raw(json []byte) *Writer
- func (w *Writer) Reset()
- func (w *Writer) Str(s string) *Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendString ¶
AppendString appends s as a JSON string. Invalid UTF-8 becomes the replacement character and the line separators U+2028 and U+2029 are escaped, as both end a JavaScript line the host reads the batch on.
Types ¶
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object builds a JSON object for an operation's argument.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer builds one batch's operations.
func (*Writer) Num ¶
Num appends a number, rounded to a hundredth: the render layer's pixels need no more.