Documentation
¶
Index ¶
- Constants
- Variables
- func AND(filters ...filterType) filterType
- func NOT(filter filterType) filterType
- func OR(filters ...filterType) filterType
- type Column
- func (c *Column) Agg(aggFunc aggregateFunc) aggregation
- func (c *Column) Equals(operand interface{}) filterType
- func (c *Column) GreaterOrEquals(operand float64) filterType
- func (c *Column) GreaterThan(operand float64) filterType
- func (c *Column) IsLike(pattern *regexp.Regexp) filterType
- func (c *Column) Items() []interface{}
- func (c *Column) LessOrEquals(operand float64) filterType
- func (c *Column) LessThan(operand float64) filterType
- func (c *Column) Order(option sortOrder) sortOption
- func (c *Column) Tx(op rowWiseFunc) transformation
- type Dataframe
- func (d *Dataframe) Clear()
- func (d *Dataframe) Col(name string) *Column
- func (d *Dataframe) ColumnNames() []string
- func (d *Dataframe) Copy() (*Dataframe, error)
- func (d *Dataframe) Count() int
- func (d *Dataframe) Delete(filter filterType) error
- func (d *Dataframe) Insert(records []map[string]interface{}) error
- func (d *Dataframe) Keys() []string
- func (d *Dataframe) Merge(dfs ...*Dataframe) error
- func (d *Dataframe) PrettyPrintRecords() error
- func (d *Dataframe) Select(fields ...string) *query
- func (d *Dataframe) ToArray(selectedFields ...string) ([]map[string]interface{}, error)
- func (d *Dataframe) Update(filter []bool, value map[string]interface{}) error
- type Datatype
Examples ¶
Constants ¶
const ( ASC sortOrder = iota DESC )
const ( // This order is important. // filter first, // then group, // then sort each group, // then apply whatever, // then select the field FILTER_ACTION actionType = iota GROUPBY_ACTION SORT_ACTION APPLY_ACTION SELECT_ACTION )
Variables ¶
var ( MAX aggregateFunc = getMax MIN aggregateFunc = getMin SUM aggregateFunc = getSum MEAN aggregateFunc = getMean COUNT aggregateFunc = getCount RANGE aggregateFunc = getRange )
Functions ¶
func AND ¶
func AND(filters ...filterType) filterType
Combines a list of filters to produce a combined AND logical filter
Types ¶
type Column ¶
func (*Column) Agg ¶
func (c *Column) Agg(aggFunc aggregateFunc) aggregation
Returns an aggregation function specific to this column to merge its values into a single value. It works when GroupBy is used
func (*Column) Equals ¶
func (c *Column) Equals(operand interface{}) filterType
Returns an array of booleans corresponding in position to each item, true if item is equal to operand or else false The operand can reference a constant, or a Col
func (*Column) GreaterOrEquals ¶
Returns an array of booleans corresponding in position to each item, true if item is greater than or equal to the operand or else false The operand can reference a constant, or a Col
func (*Column) GreaterThan ¶
Returns an array of booleans corresponding in position to each item, true if item is greater than operand or else false The operand can reference a constant, or a Col
func (*Column) IsLike ¶
Returns an array of booleans corresponding in position to each item, true if item is like the regex expression or else false
func (*Column) LessOrEquals ¶
Returns an array of booleans corresponding in position to each item, true if item is less than or equal to the operand or else false The operand can reference a constant, or a Col
func (*Column) LessThan ¶
Returns an array of booleans corresponding in position to each item, true if item is less than operand or else false The operand can reference a constant, or a Col
type Dataframe ¶
type Dataframe struct {
// contains filtered or unexported fields
}
func FromMap ¶
func FromMap(records map[interface{}]map[string]interface{}, primaryFields []string) (*Dataframe, error)
Constructs a Dataframe from a map of maps and returns a pointer to it
func (*Dataframe) Clear ¶
func (d *Dataframe) Clear()
Clears all the data held by the dataframe except the primary key fields
func (*Dataframe) ColumnNames ¶
access method to return all column names
func (*Dataframe) Insert ¶
Inserts items passed as a list of maps into the Dataframe, It will overwrite any record whose primary field values match with the new records
func (*Dataframe) PrettyPrintRecords ¶
Pretty prints the record in this dataframe
Example ¶
The PrettyPrintRecords method prints out the records in a pretty format
df, err := FromArray(dataArray, primaryFields) if err != nil { log.Fatalf("df error is: %s", err) } df.PrettyPrintRecords()
Output: [ { "age": 30, "first name": "John", "last name": "Doe", "location": "Kampala" }, { "age": 50, "first name": "Jane", "last name": "Doe", "location": "Lusaka" }, { "age": 19, "first name": "Paul", "last name": "Doe", "location": "Kampala" }, { "age": 34, "first name": "Richard", "last name": "Roe", "location": "Nairobi" }, { "age": 45, "first name": "Reyna", "last name": "Roe", "location": "Nairobi" }, { "age": 60, "first name": "Ruth", "last name": "Roe", "location": "Kampala" } ]
func (*Dataframe) Select ¶
Selects a given number of fields, and returns a query instance of the same