params

package
v0.0.0-...-62531ef Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Floater

type Floater interface {
	Float(key string, idx int) (float64, error)
}

type Inter

type Inter interface {
	Int(key string, idx int) (int, error)
}

type Key

type Key string

type NotFound

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

func (NotFound) Error

func (p NotFound) Error() string

func (NotFound) Unwrap

func (p NotFound) Unwrap() error

type Params

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

func FromFile

func FromFile(file path.ValidFile, sep string) (p Params, err error)

func FromString

func FromString(elems, sep string) (p Params)

func New

func New(sep string) (p Params)

func WithLen

func WithLen(sep string, count int) (p Params)

func (Params) Param

func (p Params) Param(key string) (s string, err error)

func (Params) Save

func (p Params) Save(file path.File) (err error)

func (Params) SaveTo

func (p Params) SaveTo(w io.StringWriter) (err error)

func (*Params) SetVal

func (p *Params) SetVal(key, val string)

func (Params) ToParser

func (p Params) ToParser() (par Parser)

type Parser

type Parser struct {
	Retreiver
}

Wrapper for interface Retreiver. If something implements the Retreiver interface, wrapping it in this struct will automatically implement the Inter and Floater interfaces.

func (Parser) Float

func (p Parser) Float(key string, idx int) (ff float64, err error)

func (Parser) Int

func (p Parser) Int(key string, idx int) (ii int, err error)

func (Parser) Splitter

func (p Parser) Splitter(key string) (sp splitted.Parser, err error)

type Retreiver

type Retreiver interface {
	Param(key string) (string, error)
}

type Separator

type Separator string

type TeeParser

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

Wrapper for reading from many Retreivers. It will try to read the appropriate parameters from each of the receivers. Returns with error if parameter could not be found in any of them.

func NewTeeParser

func NewTeeParser(retreiver ...Retreiver) (t TeeParser)

func (TeeParser) Param

func (tp TeeParser) Param(key string) (s string, err error)

func (TeeParser) ToParser

func (t TeeParser) ToParser() (p Parser)

Wrap it into a parser struct.

Jump to

Keyboard shortcuts

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