Documentation
¶
Overview ¶
Package tabular defines functions for working with rectangular datasets. qri positions tabular data as a special shape that comes with additional constraints. This package defines the methods necessary to enforce and interpret those constraints
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BaseTabularSchema = map[string]interface{}{ "type": "array", "items": map[string]interface{}{ "type": "array", "items": []interface{}{}, }, }
BaseTabularSchema is the base schema for tabular data
var ErrInvalidTabularSchema = errors.New("invalid tabular schema")
ErrInvalidTabularSchema is a base type for schemas that don't work as tables all parsing errors in this package can be errors.Is() to this one
Functions ¶
This section is empty.
Types ¶
type ColType ¶
type ColType []string
ColType implements type information for a tabular column. Column Types can be one or more strings enumerating accepted types
func (ColType) HasType ¶ added in v0.3.0
HasType ranges over the column types and returns true if the type is present
func (ColType) MarshalJSON ¶
MarshalJSON encodes to string in the common case of a single type, an array of strings for a type enumeration
func (*ColType) UnmarshalJSON ¶
UnmarshalJSON decodes string and string array data types
type Column ¶
type Column struct { Title string `json:"title"` Type *ColType `json:"type"` Description string `json:"description,omitempty"` Validation map[string]interface{} `json:"validation,omitempty"` }
Column defines values associated with an index of each row of data
type Columns ¶
type Columns []Column
Columns is an ordered list of column information
func ColumnsFromJSONSchema ¶
ColumnsFromJSONSchema extracts column data from a jsonSchema object, erroring if the provided schema cannot be used to describe a table. a slice of problem strings describes non-breaking issues with the schema that should be addressed like missing column titles or column types the passed in schema must be a decoding of a json schema into default type mappings from the encoding/json package
func (Columns) ValidMachineTitles ¶
ValidMachineTitles confirms column titles are valid for machine-readability using column titles that parse as proper variable names, and unique titles across the column set