parser

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvParser added in v0.1.7

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

func CSV added in v0.1.7

func CSV() *CsvParser

CSV returns a new CsvParser

func (*CsvParser) Unmarshal added in v0.1.7

func (p *CsvParser) Unmarshal(b []byte, v any) error

func (*CsvParser) WithDecoderConfig added in v0.1.7

func (p *CsvParser) WithDecoderConfig(conf *mapstructure.DecoderConfig) *CsvParser

func (*CsvParser) WithHeaders added in v0.1.7

func (p *CsvParser) WithHeaders(headers ...string) *CsvParser

type DotenvParser

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

func Dotenv

func Dotenv() *DotenvParser

Dotenv returns a new DotenvParser

func (*DotenvParser) Unmarshal added in v0.1.2

func (p *DotenvParser) Unmarshal(b []byte, v any) error

func (*DotenvParser) WithDecoderConfig added in v0.1.2

func (p *DotenvParser) WithDecoderConfig(conf *mapstructure.DecoderConfig) *DotenvParser

type Func added in v0.1.2

type Func func(b []byte, v any) error

func (Func) Unmarshal added in v0.1.2

func (f Func) Unmarshal(b []byte, v any) error

type Parser

type Parser interface {
	Unmarshal([]byte, any) error
}

func JSON

func JSON() Parser

JSON is the shortcut for Func(json.Unmarshal)

func TOML added in v0.1.4

func TOML() Parser

TOML is the shortcut for Func(toml.Unmarshal)

func YAML

func YAML() Parser

YAML is the shortcut for Func(yaml.Unmarshal)

type SepParser

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

func Line

func Line() *SepParser

Line is the shortcut for Sep().splitFunc(bufio.ScanLines)

func Sep

func Sep() *SepParser

Sep returns a new SepParser

func (*SepParser) Filter

func (p *SepParser) Filter(f func(token string) bool) *SepParser

func (*SepParser) SplitFunc

func (p *SepParser) SplitFunc(f bufio.SplitFunc) *SepParser

func (*SepParser) Unmarshal added in v0.1.2

func (p *SepParser) Unmarshal(b []byte, v any) error

func (*SepParser) WithDecoderConfig added in v0.1.2

func (p *SepParser) WithDecoderConfig(conf *mapstructure.DecoderConfig) *SepParser

type TableHeader

type TableHeader string

func (TableHeader) Index

func (h TableHeader) Index(isSep func(rune) bool, lines []string) ([][2]int, error)

type TableParser

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

TableParser is a builder for the TableParser

func Table

func Table() *TableParser

Table returns a new TableParser to parse a table It parses a table from an io.Reader

func (*TableParser) Unmarshal added in v0.1.2

func (p *TableParser) Unmarshal(b []byte, obj any) error

func (*TableParser) WithCallback added in v0.1.2

func (p *TableParser) WithCallback(f func(k, v string) (string, string)) *TableParser

func (*TableParser) WithDecoderConfig added in v0.1.2

func (p *TableParser) WithDecoderConfig(conf *mapstructure.DecoderConfig) *TableParser

func (*TableParser) WithFilter

func (p *TableParser) WithFilter(f func(i int, line string) bool) *TableParser

func (*TableParser) WithHeader

func (p *TableParser) WithHeader(header string) *TableParser

func (*TableParser) WithSepFunc added in v0.1.2

func (p *TableParser) WithSepFunc(f func(rune) bool) *TableParser

Jump to

Keyboard shortcuts

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