Documentation ¶
Overview ¶
Package ds exposes the qri dataset document model into starlark
Index ¶
- Constants
- func LoadModule() (starlark.StringDict, error)
- func New(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- type Dataset
- func (d *Dataset) Dataset() *dataset.Dataset
- func (d *Dataset) GetBody(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func (d *Dataset) GetMeta(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func (d *Dataset) GetStructure(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func (d *Dataset) Methods() *starlarkstruct.Struct
- func (d *Dataset) SetBody(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func (d *Dataset) SetMeta(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func (d *Dataset) SetStructure(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- type EntryReader
- type MutateFieldCheck
- type StarlarkEntryWriter
Constants ¶
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.
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) 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
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
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
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