ds

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Overview

Package ds exposes the qri dataset document model into starlark

Index

Constants

View Source
const ModuleName = "dataset.star"

ModuleName defines the expected name for this Module when used in starlark's load() function, eg: load('dataset.star', 'dataset')

Variables

This section is empty.

Functions

func LoadModule added in v0.3.0

func LoadModule() (starlark.StringDict, error)

LoadModule loads the base64 module. It is concurrency-safe and idempotent.

func New added in v0.3.0

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

New creates a new dataset from starlark land

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, check MutateFieldCheck) *Dataset

NewDataset creates a dataset object, intended to be called from go-land to prepare datasets for handing to other functions

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) GetMeta added in v0.3.2

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

GetMeta gets a dataset meta component

func (*Dataset) GetStructure added in v0.3.0

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

GetStructure gets a dataset structure component

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) SetStructure added in v0.3.0

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

SetStructure sets the dataset structure component

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) Close added in v0.2.1

func (r *EntryReader) Close() error

Close finalizes the 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