reader

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package reader contains helpers for reading data and loading to Arrow.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUndefinedInput = errors.New("nil input")
	ErrInvalidInput   = errors.New("invalid input")
)

Functions

func InputMap

func InputMap(a any) (map[string]any, error)

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 Encoder

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

An Encoder takes structured data and converts it into an interface following the mapstructure tags.

func New

func New(cfg *EncoderConfig) *Encoder

New returns a new encoder for the configuration.

func (*Encoder) Encode

func (e *Encoder) Encode(input any) (any, error)

Encode takes the input and uses reflection to encode it to an interface based on the mapstructure spec.

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.

Jump to

Keyboard shortcuts

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