Documentation ¶
Overview ¶
Package types defines helpers for type conversions.
The API for this package is not finalized yet.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BoolValues = map[string]interface{}{ "true": true, "yes": true, "on": true, "1": true, "false": false, "no": false, "off": false, "0": false, }
BoolValues defines the name and value mappings for ParseBool.
Functions ¶
func ParseBool ¶
ParseBool parses bool values according to the definitions in BoolValues. Parsing is case-insensitive.
Types ¶
type EnumParser ¶
type EnumParser struct { Type string // type name; if not set, use type of first value added CaseMatch bool // if true, matching of strings is case-sensitive // contains filtered or unexported fields }
EnumParser parses "enum" values; i.e. a predefined set of strings to predefined values.
func (*EnumParser) AddVals ¶
func (ep *EnumParser) AddVals(vals map[string]interface{})
AddVals adds strings and values to an EnumParser.
func (EnumParser) Parse ¶
func (ep EnumParser) Parse(s string) (interface{}, error)
Parse parses the string and returns the value or an error.
Click to show internal directories.
Click to hide internal directories.