Documentation ¶
Index ¶
- Constants
- type Edge
- type Graph
- type GraphFull
- type GraphMetadata
- type Node
- type NodeMetadata
- type NodeValue
- type PatchSet
- type SVG
- type Table
- func (t *Table) ApplyOps(ops ...TableOp) error
- func (t *Table) Delete(row, col int) error
- func (t *Table) DeleteColumn(columnIndex int) error
- func (t *Table) DeleteRow(rowIndex int) error
- func (t *Table) InsertColumn(columnIndex int, newColumn TableColumn) error
- func (t *Table) InsertRow(rowIndex int, rowValues []any) error
- func (t *Table) Range(r TableRange) [][]any
- func (t *Table) ReorderColumn(oldColumn, newColumn int) error
- func (t *Table) ReorderRow(oldRow, newRow int) error
- func (t *Table) RowCount() (maxRows int)
- func (t *Table) Rows() [][]any
- func (t *Table) Set(row, col int, value any) error
- func (t *Table) SetColumnName(columnIndex int, columnName string) error
- type TableColumn
- type TableInfo
- type TableOp
- type TableOpType
- type TableRange
- type Viewport
Constants ¶
const ( TableOpTypeSet = "set" TableOpTypeSetColumnName = "set_column_name" TableOpTypeDelete = "delete" TableOpTypeInsertColumn = "insert_column" TableOpTypeDeleteColumn = "delete_column" TableOpTypeInsertRow = "insert_row" TableOpTypeDeleteRow = "delete_row" TableOpTypeReorderColumn = "reorder_column" TableOpTypeReorderRow = "reorder_row" )
TableOp types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct { ParentID incr.Identifier `json:"parent_id"` ChildID incr.Identifier `json:"child_id"` ChildInputName string `json:"child_input_name"` }
Edge is a represented edge in the graph between a source node (the parent) and the target node (the child).
type Graph ¶
type Graph struct { ID incr.Identifier `json:"id"` Label string `json:"label"` StabilizationNum uint64 `json:"stabilization_num"` Metadata GraphMetadata `json:"metadata"` }
func GraphFromIncr ¶
func GraphFromIncr(g *incr.Graph) *Graph
GraphFromIncr returns a db graph from an incremental graph object.
type GraphFull ¶
type GraphFull struct { Graph *Graph `json:"graph"` Nodes []Node `json:"nodes,omitempty"` Edges []Edge `json:"edges,omitempty"` Values []NodeValue `json:"values,omitempty"` RecomputeHeap []incr.Identifier `json:"recompute_heap,omitempty"` }
GraphFull is a serialized graph.
type GraphMetadata ¶
type Node ¶
type Node struct { // ID is a unique identifier for the node. ID incr.Identifier `json:"id"` // Label is the descriptive label for the node. Label string `json:"label,omitempty"` // Metadata is data that's held on the node metadata field. // // It will not be data that is inferred from the INode itself. Metadata NodeMetadata `json:"metadata"` // these are from the incremental node metadata specifically Always bool `json:"always"` Observer bool `json:"observer"` Valid bool `json:"valid"` ChangedAt uint64 `json:"changed_at"` RecomputedAt uint64 `json:"recomputed_at"` SetAt uint64 `json:"set_at"` Height int `json:"height"` HeightInRecomputeHeap int `json:"height_in_recompute_heap"` HeightInAdjustHeightsHeap int `json:"height_in_adjust_heights_heap"` }
Node is the serialized / api form of the incr node(s).
type NodeMetadata ¶
type NodeMetadata struct { Collapsed bool `json:"collapsed"` Watched bool `json:"watched"` WatchedCollapsed bool `json:"watched_collapsed"` PositionX float64 `json:"position_x"` PositionY float64 `json:"position_y"` Height *float64 `json:"height"` Width *float64 `json:"width"` NodeType string `json:"node_type"` InputType string `json:"input_type,omitempty"` OutputType string `json:"output_type,omitempty"` Expression string `json:"expression,omitempty"` }
NodeMetadata is strictly the data that's held on the INode.Metadata() field.
type NodeValue ¶
type NodeValue struct { ID incr.Identifier `json:"id"` ValueType string `json:"value_type"` Value any `json:"value,omitempty"` }
NodeValue is a value for a node.
type Table ¶
type Table struct {
Columns []TableColumn `json:"columns"`
}
Table is a column oriented store of data.
Specifically it breaks the data into columns, and those columns have values which you can think of as rows.
This makes inserting a new column very easy (and fast!), but it also means that some operations are kind of finicky (specifically inserting rows).
func TableFromCSV ¶
TableFromCSV returns a table from a csv.
func TableFromCSVReader ¶
TableFromCSVReader returns a table from a reader that holds csv data.
func TableFromJSON ¶
TableFromJSON returns a table from a json object.
func (*Table) DeleteColumn ¶
DeleteColumn deletes a column at a given index.
func (*Table) InsertColumn ¶
func (t *Table) InsertColumn(columnIndex int, newColumn TableColumn) error
InsertColumn insets a new column at a given index.
func (*Table) Range ¶
func (t *Table) Range(r TableRange) [][]any
Range returns a subset of the table data according to a given range predicate.
func (*Table) ReorderColumn ¶
ReorderColumn swaps the column order from a given old index to a given new index.
func (*Table) ReorderRow ¶
ReorderRow swaps the row order from a given old index to a given new index.
func (*Table) RowCount ¶
RowCount returns the maximum number of rows in any of the columns of the table.
type TableColumn ¶
type TableColumn struct { Name string `json:"name"` ValueType string `json:"value_type"` Values []any `json:"values"` }
TableColumn is a vector of data.
func TableColumnFromJSON ¶
func TableColumnFromJSON(obj map[string]any) (*TableColumn, error)
TableColumnFromJSON returns a table column from a json object.
type TableOp ¶
type TableOp struct { // type determines what function to call Type string `json:"type"` // the column name typically Name string `json:"name"` // the colmn value type typically ValueType string `json:"value_type"` // used for various commands Col int `json:"col"` Row int `json:"row"` // used for reodering Old int `json:"old"` New int `json:"new"` // for setting the value Value any `json:"value"` // for inserting rows and columns Values []any `json:"values"` }
TableOp is an operation a user can take on a table.
NOTE(wc): The format here is kind of gross because we don't have the ability to do the typescript thing where we discriminate types based on a string field value.
We could use interfaces and do a bunch of careful implementing but this is fine for now.