Documentation ¶
Index ¶
- Variables
- type CSVOptions
- type DataIterContext
- type DataRelation
- type DataRow
- func (s DataRow) ForEachChildRelations(iter func(i int, rr DataRowRange) bool) bool
- func (s DataRow) ForEachColumns(iter func(c int, name []string, v interface{}))
- func (s DataRow) Get(col int) interface{}
- func (s DataRow) RawValues(vs []interface{}) []interface{}
- func (s DataRow) Set(col int, v interface{}) error
- func (s DataRow) Values(vs []interface{}) []interface{}
- type DataRowRange
- type DataTable
- func NewDataTable(rtCtx *runtime.RuntimeContext, types ...DataColumnType) *DataTable
- func NewDataTableFromCSV(rtCtx *runtime.RuntimeContext, reader *csv.Reader, options CSVOptions) (*DataTable, error)
- func NewDataTableWithSize(rtCtx *runtime.RuntimeContext, l, c int, types ...DataColumnType) *DataTable
- func NewDatatableFromDescribe(rtCtx *runtime.RuntimeContext, describeObj *DescribeObject) (*DataTable, error)
- func (p *DataTable) Aggregate(groupBy []int, having []FilterInfo, cols ...SelectInfo) (*DataTable, error)
- func (p *DataTable) Append(iter func(i int, row DataRow) bool)
- func (p *DataTable) AppendFromCSV(reader *csv.Reader, options CSVOptions) error
- func (p *DataTable) AppendFromJSONLines(reader io.Reader) error
- func (p *DataTable) Borrow() *DataTable
- func (p *DataTable) Cap() int
- func (p *DataTable) ColLen() int
- func (p *DataTable) ColNames() [][]string
- func (p *DataTable) ColSimpleNames() []string
- func (p *DataTable) Filter(filters ...FilterInfo) error
- func (p *DataTable) ForEach(iter func(i int, row DataRow) bool)
- func (p *DataTable) FullJoin(colL int, dtR *DataTable, colR int, relName string, options JoinOptions) (*DataTable, error)
- func (p *DataTable) GetDescribe() *DescribeObject
- func (p *DataTable) Grow(n int)
- func (p *DataTable) InnerJoin(colL int, dtR *DataTable, colR int, relName string, options JoinOptions) (*DataTable, error)
- func (p *DataTable) LeftJoin(colL int, dtR *DataTable, colR int, relName string, options JoinOptions) (*DataTable, error)
- func (p *DataTable) Len() int
- func (p *DataTable) Materialize()
- func (p *DataTable) Own()
- func (p *DataTable) ResetIndex()
- func (p *DataTable) Resize(n int)
- func (p *DataTable) Reverse()
- func (p *DataTable) RootObjectColLen() int
- func (p *DataTable) RootObjectsRowRange() DataRowRange
- func (p *DataTable) Select(cols ...SelectInfo) (*DataTable, error)
- func (p *DataTable) SetHeader(header [][]string) error
- func (p *DataTable) SetSimpleHeader(header []string) error
- func (p *DataTable) Slice(offset, limit int) *DataTable
- func (p *DataTable) Sort(orders ...SortInfo) error
- func (p *DataTable) ToUntyped(iter func(i int, record map[string]interface{}) bool) bool
- func (p *DataTable) Unmarshal(to interface{}) error
- func (p *DataTable) Walk(...) bool
- func (p *DataTable) WriteToCSV(writer *csv.Writer, options CSVOptions) error
- type JoinOptions
Constants ¶
This section is empty.
Variables ¶
var ( // This is for internal debugging only. DO NOT USE THIS in your code. Disable "fast filter" if this is true. DbgNoFastFilter = false )
Functions ¶
This section is empty.
Types ¶
type CSVOptions ¶
type DataIterContext ¶
type DataIterContext struct {
// contains filtered or unexported fields
}
func NewDataIterContextWithCache ¶
func NewDataIterContextWithCache(dt *DataTable) DataIterContext
Make a new data iterator context.
func (DataIterContext) RootObjectCols ¶
func (s DataIterContext) RootObjectCols() []int
Get the number of columns of the root objects.
type DataRelation ¶
type DataRelation struct { DataIterContext // contains filtered or unexported fields }
func (DataRelation) ColLen ¶
func (s DataRelation) ColLen() int
Get the number of columns of the current objects.
func (DataRelation) ForEachChildRelationDescribes ¶
func (s DataRelation) ForEachChildRelationDescribes(iter func(i int, rel DataRelation) bool) bool
Iterate the child relations.
func (DataRelation) Names ¶
func (s DataRelation) Names(ns [][]string) [][]string
Get the column names as a slice.
func (DataRelation) SimpleNames ¶
func (s DataRelation) SimpleNames(ns []string) []string
Get the column names as a slice.
type DataRow ¶
type DataRow struct { DataRowRange // contains filtered or unexported fields }
DataRow represents a row in the data table.
func (DataRow) ForEachChildRelations ¶
func (s DataRow) ForEachChildRelations(iter func(i int, rr DataRowRange) bool) bool
Iterate the child relations.
func (DataRow) ForEachColumns ¶
Iterate the column.
func (DataRow) RawValues ¶
func (s DataRow) RawValues(vs []interface{}) []interface{}
Get the column raw values as a slice.
type DataRowRange ¶
type DataRowRange struct { *DataRelation // contains filtered or unexported fields }
func (DataRowRange) ForEachObjects ¶
func (s DataRowRange) ForEachObjects(iter func(i int, row DataRow) bool) bool
Iterate the objects.
type DataTable ¶
type DataTable struct {
// contains filtered or unexported fields
}
Data table
func NewDataTable ¶
func NewDataTable(rtCtx *runtime.RuntimeContext, types ...DataColumnType) *DataTable
Create a new DataTable.
func NewDataTableFromCSV ¶
func NewDataTableFromCSV(rtCtx *runtime.RuntimeContext, reader *csv.Reader, options CSVOptions) (*DataTable, error)
NewDataTableFromCSV creates a new data table from the CSV reader.
func NewDataTableWithSize ¶
func NewDataTableWithSize(rtCtx *runtime.RuntimeContext, l, c int, types ...DataColumnType) *DataTable
Create a new DataTable with size and capacity.
func NewDatatableFromDescribe ¶
func NewDatatableFromDescribe(rtCtx *runtime.RuntimeContext, describeObj *DescribeObject) (*DataTable, error)
func (*DataTable) Aggregate ¶
func (p *DataTable) Aggregate(groupBy []int, having []FilterInfo, cols ...SelectInfo) (*DataTable, error)
Aggregate rows by `group-by` columns and apply aggregate functions to the other columns. Filter aggregated rows by `having` clause.
func (*DataTable) AppendFromCSV ¶
func (p *DataTable) AppendFromCSV(reader *csv.Reader, options CSVOptions) error
AppendFromCSV appends the data from the CSV reader. TODO: null treating
func (*DataTable) AppendFromJSONLines ¶
AppendFromJSON appends rows from JSON Lines stream.
func (*DataTable) Borrow ¶
Borrow all columns and indices. The newly returned DataTable shares memory for columns and indices.
func (*DataTable) ColSimpleNames ¶
Returns the column names without namespaces.
func (*DataTable) Filter ¶
Filter rows. The index is changed. The order of the physical rows does not change. Destructive method.
func (*DataTable) FullJoin ¶
func (p *DataTable) FullJoin(colL int, dtR *DataTable, colR int, relName string, options JoinOptions) (*DataTable, error)
Full join by colL and colR; colL must be primary key and colR must be foreign key.
func (*DataTable) GetDescribe ¶
func (p *DataTable) GetDescribe() *DescribeObject
func (*DataTable) InnerJoin ¶
func (p *DataTable) InnerJoin(colL int, dtR *DataTable, colR int, relName string, options JoinOptions) (*DataTable, error)
Inner join by colL and colR; colL must be primary key and colR must be foreign key.
func (*DataTable) LeftJoin ¶
func (p *DataTable) LeftJoin(colL int, dtR *DataTable, colR int, relName string, options JoinOptions) (*DataTable, error)
Left join by colL and colR; colL must be primary key and colR must be foreign key.
func (*DataTable) Materialize ¶
func (p *DataTable) Materialize()
Convert the table to have physical columns of index order and size. Destructive method.
func (*DataTable) Own ¶
func (p *DataTable) Own()
Take ownership of all columns and indices. Columns and indices that did not have ownership will be copied.
func (*DataTable) ResetIndex ¶
func (p *DataTable) ResetIndex()
Reset the index to the same order as the physical rows. Destructive method.
func (*DataTable) RootObjectColLen ¶
Get the number of columns of the root objects.
func (*DataTable) RootObjectsRowRange ¶
func (p *DataTable) RootObjectsRowRange() DataRowRange
Get the root object iterator.
func (*DataTable) Select ¶
Returns a new data table with the columns transformed. If all columns of a new table are not populated by formulas, the columns are shared with the original data table.
func (*DataTable) SetSimpleHeader ¶
Name the columns.
func (*DataTable) Slice ¶
Returns a new data table with sliced rows. The columns are shared with the original data table.
func (*DataTable) Sort ¶
Sort rows. The index is changed. The order of the physical rows does not change. Destructive method.
func (*DataTable) ToUntyped ¶
ToUntyped converts the data table record to untyped object (`map[string]interface{}`). Object graph is recovered from the data table.
func (*DataTable) Walk ¶
func (p *DataTable) Walk( iter func(lv, i int, path []string, fieldNames []string, vals []interface{}, row DataRow, cols []int) bool) bool
Iterate the object graph.
func (*DataTable) WriteToCSV ¶
func (p *DataTable) WriteToCSV(writer *csv.Writer, options CSVOptions) error
WriteToCSV writes the data table to the CSV writer. TODO: null treating
type JoinOptions ¶
type JoinOptions struct {
RightMustZeroOrOnce bool
}