csv

package
v1.0.0-beta11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const CSV = ls.LS + "csv/"

Variables

This section is empty.

Functions

func Import

func Import(attributeID string, terms []TermSpec, startRow, nRows int, idRows []int, entityID string, required string, input [][]string) (*ls.Layer, error)

Import a CSV schema. The CSV file is organized as columns, one column for base attribute names, and other columns for overlays. CSV does not support nested attributes. Returns an array of Layer objects

Types

type ErrColIndexOutOfBounds

type ErrColIndexOutOfBounds struct {
	For   string
	Index int
}

func (ErrColIndexOutOfBounds) Error

func (e ErrColIndexOutOfBounds) Error() string

type ErrInvalidID

type ErrInvalidID struct {
	Row int
}

func (ErrInvalidID) Error

func (e ErrInvalidID) Error() string

type Ingester

type Ingester struct {
	ls.Ingester
	ColumnNames []string
}

Ingester is a wrapper for the ls/Ingester struct

func (Ingester) Ingest

func (ingester Ingester) Ingest(context *ls.Context, data []string, ID string) (graph.Node, error)

Ingest a row of CSV data. The `data` slice is a row of data. The ID is the assigned identifier for the resulting object. ID is empty, IDs are assigned based on schema-dictated identifiers.

type TermSpec

type TermSpec struct {
	// The term
	Term string `json:"term"`
	// If nonempty, this template is used to build the term contents
	// with {{.term}}, and {{.row}} in template context. {{.term}} gives
	// the Term, and {{.row}} gives the cells of the current row
	TermTemplate string `json:"template"`
	// Is property an array
	Array bool `json:"array"`
	// Array separator character
	ArraySeparator string `json:"separator"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL