Documentation ¶
Index ¶
- Variables
- func CBORSchema(resource *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
- func CSVSchema(resource *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
- func ExtensionDataFormat(path string) (format dataset.DataFormat, err error)
- func FromFile(path string) (st *dataset.Structure, err error)
- func FromReader(format dataset.DataFormat, data io.Reader) (st *dataset.Structure, n int, err error)
- func JSONSchema(resource *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
- func Schema(r *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
- func Structure(ds *dataset.Dataset) error
- func TabularSchemaFromTabularData(source interface{}) (map[string]interface{}, error)
- func XLSXSchema(r *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidTabularData = errors.New("invalid tabular data")
ErrInvalidTabularData indicates non-tabular data in a context that expects tabular input
Functions ¶
func CBORSchema ¶
func CBORSchema(resource *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
CBORSchema determines the field names and types of an io.Reader of CBOR-formatted data, returning a json schema
func CSVSchema ¶
func CSVSchema(resource *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
CSVSchema determines the field names and types of an io.Reader of CSV-formatted data, returning a json schema
func ExtensionDataFormat ¶
func ExtensionDataFormat(path string) (format dataset.DataFormat, err error)
ExtensionDataFormat returns the corresponding DataFormat for a given file extension if one exists TODO - this should probably come from the dataset package
func FromFile ¶
FromFile takes a filepath & tries to work out the corresponding dataset for the sake of speed, it only works with files that have a recognized extension
func FromReader ¶
func FromReader(format dataset.DataFormat, data io.Reader) (st *dataset.Structure, n int, err error)
FromReader detects a dataset structure from a reader and data format, returning a detected dataset structure, the number of bytes read from the reader, and any error
func JSONSchema ¶
func JSONSchema(resource *dataset.Structure, data io.Reader) (schema map[string]interface{}, n int, err error)
JSONSchema determines the field names and types of an io.Reader of JSON-formatted data, returning a json schema This is currently a suuuuuuuuper simple interpretation that spits out a generic schema that'll work. In the future we can do all sorts of stuff here to make better inferences about the shape of a dataset, but for now, this'll work, and we'll instead focus on making it easier for users to provide hand-built schemas
func Structure ¶ added in v0.3.0
Structure examines the contents of a dataset body, setting any missing elements of a structure component required to make the dataset readable. A minimum structure component has non-zero Format and Schema fields, and may need additional FormatConfig settings to parse properly. Structure will not mutate any component fields that are not a default value
func TabularSchemaFromTabularData ¶ added in v0.2.0
TabularSchemaFromTabularData infers a basic tabular JSON schema from go types it only works in the narrow case where the source data is known to be tabular but lacks a schema to describe it given the lack of metadata, these schema should be used primarily for machine purposes
Types ¶
This section is empty.