Documentation
¶
Overview ¶
Package reader contains helpers for reading data and loading to Arrow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUndefinedInput = errors.New("nil input") ErrInvalidInput = errors.New("invalid input") )
var (
ErrNullStructData = errors.New("null struct data")
)
Functions ¶
func InputMap ¶
InputMap takes structured input data and attempts to decode it to map[string]any. Input data can be json in string or []byte, or any other Go data type which can be decoded by MapStructure/v2. MapStructure/v2: github.com/go-viper/mapstructure/v2
func TextMarshalerHookFunc ¶
func TextMarshalerHookFunc() mapstructure.DecodeHookFuncValue
TextMarshalerHookFunc returns a DecodeHookFuncValue that checks for the encoding.TextMarshaler interface and calls the MarshalText function if found.
Types ¶
type DataReader ¶ added in v0.3.0
type DataReader struct {
// contains filtered or unexported fields
}
func NewReader ¶ added in v0.3.0
func NewReader(schema *arrow.Schema, source DataSource, opts ...Option) (*DataReader, error)
func (*DataReader) Err ¶ added in v0.3.0
func (r *DataReader) Err() error
Err returns the last error encountered during the reading of data.
func (*DataReader) ReadToRecord ¶ added in v0.3.0
func (r *DataReader) ReadToRecord(a any) (arrow.Record, error)
func (*DataReader) Release ¶ added in v0.3.0
func (r *DataReader) Release()
Release decreases the reference count by 1. When the reference count goes to zero, the memory is freed. Release may be called simultaneously from multiple goroutines.
func (*DataReader) Retain ¶ added in v0.3.0
func (r *DataReader) Retain()
Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.
func (*DataReader) Schema ¶ added in v0.3.0
func (r *DataReader) Schema() *arrow.Schema
type DataSource ¶ added in v0.3.0
type DataSource int
const ( DataSourceGo DataSource = iota DataSourceJSON DataSourceAvro )
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder takes structured data and converts it into an interface following the mapstructure tags.
type EncoderConfig ¶
type EncoderConfig struct {
// EncodeHook, if set, is a way to provide custom encoding. It
// will be called before structs and primitive types.
EncodeHook mapstructure.DecodeHookFunc
}
EncoderConfig is the configuration used to create a new encoder.
type Option ¶ added in v0.3.0
type Option func(config)
Option configures an Avro reader/writer.
func WithAllocator ¶ added in v0.3.0
WithAllocator specifies the Arrow memory allocator used while building records.
func WithJSONDecoder ¶ added in v0.3.0
func WithJSONDecoder() Option
WithJSONDecoder specifies whether to use goccy/json-go as the Bodkin Reader's decoder. The default is the Bodkin DataLoader, a linked list of builders which reduces recursive lookups in maps when loading data.