sniff

package
v0.0.0-...-6fab397 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJSON   = FormatType("json")
	FormatYAML   = FormatType("yaml")
	FormatCSV    = FormatType("csv")
	FormatTSV    = FormatType("tsv")
	FormatSSV    = FormatType("ssv")
	FormatShell  = FormatType("shell")
	FormatLogfmt = FormatType("logfmt")
	FormatJSONL  = FormatType("jsonl")
)
View Source
const (
	KindInt       = ValueKind("int")
	KindNumber    = ValueKind("number")
	KindString    = ValueKind("string")
	KindNull      = ValueKind("null")
	KindDate      = ValueKind("date")
	KindTimestamp = ValueKind("timestamp")
)

Variables

This section is empty.

Functions

func DetectNestedFields

func DetectNestedFields(records []interfaces.Record) (map[string]ValueType, error)

Types

type Descriptor

type Descriptor struct {
	Format      FormatType
	TupleBased  bool
	HasHeader   bool
	NumColumns  int
	ColumnNames []string
	FieldTypes  map[string]ValueType
}

func Sniff

func Sniff(data []byte) (*Descriptor, error)

func (*Descriptor) Show

func (d *Descriptor) Show(w io.Writer)

type FormatType

type FormatType string

type ValueKind

type ValueKind string

type ValueType

type ValueType struct {
	Kind     ValueKind
	Optional bool
	Format   string
}

func DetectValueType

func DetectValueType(values []string) ValueType

func (ValueType) IsNull

func (t ValueType) IsNull() bool

func (ValueType) String

func (t ValueType) String() string

Jump to

Keyboard shortcuts

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