ds

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package ds exposes the qri dataset document model into starlark

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dataset

type Dataset struct {
	// contains filtered or unexported fields
}

Dataset is a qri dataset starlark type

func NewDataset

func NewDataset(ds *dataset.Dataset, bodyFile cafs.File, check MutateFieldCheck) *Dataset

NewDataset creates a dataset object

func (*Dataset) BodyFile added in v0.2.0

func (d *Dataset) BodyFile() cafs.File

BodyFile gives access to the private bodyFile

func (*Dataset) Dataset

func (d *Dataset) Dataset() *dataset.Dataset

Dataset returns the underlying dataset

func (*Dataset) GetBody

func (d *Dataset) GetBody(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

GetBody returns the body of the dataset we're transforming

func (*Dataset) Methods

func (d *Dataset) Methods() *starlarkstruct.Struct

Methods exposes dataset methods as starlark values

func (*Dataset) SetBody

func (d *Dataset) SetBody(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

SetBody assigns the dataset body

func (*Dataset) SetMeta

func (d *Dataset) SetMeta(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

SetMeta sets a dataset meta field

func (*Dataset) SetSchema

func (d *Dataset) SetSchema(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

SetSchema sets the dataset schema field

type EntryReader

type EntryReader struct {
	// contains filtered or unexported fields
}

EntryReader implements the dsio.EntryReader interface for starlark.Iterable's

func NewEntryReader

func NewEntryReader(st *dataset.Structure, iter starlark.Iterable) *EntryReader

NewEntryReader creates a new Entry Reader

func (*EntryReader) ReadEntry

func (r *EntryReader) ReadEntry() (e dsio.Entry, err error)

ReadEntry reads one entry from the reader

func (*EntryReader) Structure

func (r *EntryReader) Structure() *dataset.Structure

Structure gives this reader's structure

type MutateFieldCheck added in v0.2.0

type MutateFieldCheck func(path ...string) error

MutateFieldCheck is a function to check if a dataset field can be mutated before mutating a field, dataset will call MutateFieldCheck with as specific a path as possible and bail if an error is returned

type StarlarkEntryWriter added in v0.2.0

type StarlarkEntryWriter struct {
	IsDict bool
	Struct *dataset.Structure
	Object starlark.Value
}

StarlarkEntryWriter creates a starlark.Value as an EntryWriter

func NewStarlarkEntryWriter added in v0.2.0

func NewStarlarkEntryWriter(st *dataset.Structure) (*StarlarkEntryWriter, error)

NewStarlarkEntryWriter returns a new StarlarkEntryWriter

func (*StarlarkEntryWriter) Close added in v0.2.0

func (w *StarlarkEntryWriter) Close() error

Close is a no-op

func (*StarlarkEntryWriter) Structure added in v0.2.0

func (w *StarlarkEntryWriter) Structure() *dataset.Structure

Structure returns the EntryWriter's dataset structure

func (*StarlarkEntryWriter) Value added in v0.2.0

func (w *StarlarkEntryWriter) Value() starlark.Value

Value returns the underlying starlark.Value

func (*StarlarkEntryWriter) WriteEntry added in v0.2.0

func (w *StarlarkEntryWriter) WriteEntry(ent dsio.Entry) error

WriteEntry adds an entry to the underlying starlark.Value

Jump to

Keyboard shortcuts

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