Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

Commit

Permalink
Improve docs around the interface for Data.Sources and providing the …
Browse files Browse the repository at this point in the history
…Data.schema method. Fixes #23"
  • Loading branch information
quinnj committed Oct 26, 2016
1 parent 090d6b6 commit 2cca825
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Packages can have a single julia type implement both the `Data.Source` and `Data

The `Data.Source` interface requires the following definitions, where `MyPkg` would represent a package wishing to implement the interface:

* `Data.schema(::MyPkg.Source) => Data.Schema`; get the `Data.Schema` of a `Data.Source`. Typically the `Source` type will store the `Data.Schema` directly, but this isn't strictly required. See `?Data.Schema` or docs below for more information on `Data.Schema`
* `Data.isdone(::MyPkg.Source, row, col) => Bool`; indicates whether the `Data.Source` will be able to provide a value at a given a `row` and `col`.

Optional definition:
Expand All @@ -37,12 +36,14 @@ A `Data.Source` also needs to "register" the type (or types) of streaming it sup

A `Data.Source` formally supports **field-based** streaming by defining the following:

* `Data.schema(::MyPkg.Source, ::Type{Data.Field}) => Data.Schema`; get the `Data.Schema` of a `Data.Source`. The column types of `MyPkg.Source` are provided as "scalar" types, so `Nullable{Int}` instead of `NullableVector{Int}`. Typically the `Source` type will store the `Data.Schema` directly, but this isn't strictly required. See `?Data.Schema` or docs below for more information on `Data.Schema`
* `Data.streamtype(::Type{MyPkg.Source}, ::Type{Data.Field}) = true`; declares that `MyPkg.Source` supports field-based streaming
* `Data.streamfrom{T}(::MyPkg.Source, ::Type{Data.Field}, ::Type{Nullable{T}}, row, col) => Nullable{T}`; returns a value of type `Nullable{T}` given a specific `row` and `col` from `MyPkg.Source`
* `Data.streamfrom{T}(::MyPkg.Source, ::Type{Data.Field}, ::Type{T}, row, col) => T`; returns a value of type `T` given a specific `row` and `col` from `MyPkg.Source`

And for column-based streaming:

* `Data.schema(::MyPkg.Source, ::Type{Data.Column}) => Data.Schema`; get the `Data.Schema` of a `Data.Source`. The column types of `MyPkg.Source` are provided as "vector" types, so `NullableVector{Int}` instead of `Nullable{Int}`. Typically the `Source` type will store the `Data.Schema` directly, but this isn't strictly required. See `?Data.Schema` or docs below for more information on `Data.Schema`
* `Data.streamtype(::Type{MyPkg.Source}, ::Type{Data.Column}) = true`
* `Data.streamfrom{T}(::Data.Source, ::Type{Data.Column}, ::Type{T}, col) => Vector{T}`; Given a type `T`, returns column # `col` of a `Data.Source` as a `Vector{T}`
* `Data.streamfrom{T}(::Data.Source, ::Type{Data.Column}, ::Type{Nullable{T}}, col) => NullableVector{T}`; Given a type `Nullable{T}`, returns column # `col` of a `Data.Source` as a `NullableVector{T}`
Expand Down

0 comments on commit 2cca825

Please sign in to comment.