Documentation ¶
Overview ¶
PonGo (Properties on Go) is a package that converts properties files in complex structures.
The file with the following content, for example
map.a=11 map.b=22 name=myname age=33 arr=1,2,3,4 t=2014-03-18
loaded in struct
struct { TheName string `pongo:"name"` TheAge int `pongo:"age"` Map map[string]int Array []int `pongo:"arr,inline"` T *time.Time `pongo:",timeformat=2006-01-02` }
becomes
{TheName:"myname" TheAge:33 Map:map[a:11 b:22] Array:[1 2 3 4] T:2014-03-18 00:00:00 +0000 UTC}
PonGo supports the following tags:
timeformat: specifies a time parsing format inline: the string value is intended as an inline array splitted with the decoder separator
A prefix is a string used in the decoding phase to complete the properties names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDataLeft ¶
Checks if err is a ErrDataLeft and returns the unread keys.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder reads and decodes properties into struct from an input stream.
func NewDecoder ¶
NewDecoder returns a new decoder that reads from r, env is the preferred environment, and sep is the regex used to split inline array.
type ErrDataLeft ¶
type ErrDataLeft struct {
// contains filtered or unexported fields
}
Some data in the reader has not been assigned.
func (*ErrDataLeft) Error ¶
func (err *ErrDataLeft) Error() string
Click to show internal directories.
Click to hide internal directories.