parsing

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(g Getter, key string) (s string, b bool)

func GetFloat

func GetFloat(g Getter, key string) (f float64, err error)

func GetFloat32

func GetFloat32(g Getter, key string) (f float32, err error)

func GetFloat64

func GetFloat64(g Getter, key string) (f float64, err error)

func GetInt

func GetInt(g Getter, key string) (i int, err error)

func GetVal

func GetVal(g Getter, key string, val Value) (err error)

func MustGet

func MustGet(g Getter, key string) (s string, err error)

func ParseStruct

func ParseStruct(g Getter, s *StructInfo) (err error)

Types

type FieldInfoMap

type FieldInfoMap map[string]Value

type Float32

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

func (Float32) Get

func (f Float32) Get() (fl float32)

func (*Float32) Set

func (f *Float32) Set(s string) (err error)

type Float64

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

func (Float64) Get

func (f Float64) Get() (fl float64)

func (*Float64) Set

func (f *Float64) Set(s string) (err error)

type Getter

type Getter interface {
	GetParam(string) string
}

type Int

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

func (Int) Get

func (i Int) Get() (ii int)

func (*Int) Set

func (i *Int) Set(s string) (err error)

type KeyNotFound

type KeyNotFound struct {
	Key string
}

func (KeyNotFound) Error

func (k KeyNotFound) Error() (s string)

type NumberParseFail

type NumberParseFail struct {
	NumericalType
	Source string
	// contains filtered or unexported fields
}

func (NumberParseFail) Error

func (n NumberParseFail) Error() (s string)

func (NumberParseFail) Unwrap

func (n NumberParseFail) Unwrap() (err error)

type NumericalType

type NumericalType int
const (
	NumberInt NumericalType = iota
	NumberFloat32
	NumberFloat64
)

func (NumericalType) String

func (n NumericalType) String() (s string)

type Parser

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

func New

func New(g Getter) (p Parser)

func (Parser) Get

func (p Parser) Get(key string) (s string, b bool)

func (Parser) Int

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

func (Parser) MustGet

func (p Parser) MustGet(key string) (s string, err error)

type StructInfo

type StructInfo struct {
	FieldMap FieldInfoMap
}

type Value

type Value interface {
	Set(string) error
}

Jump to

Keyboard shortcuts

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