Documentation ¶
Index ¶
- func RootSection() string
- type ConfSet
- func (c *ConfSet) Bool(sectionName, name string, value bool) *bool
- func (c *ConfSet) BoolVar(p *bool, sectionName, name string, value bool)
- func (c *ConfSet) Duration(sectionName, name string, value time.Duration) *time.Duration
- func (c *ConfSet) DurationVar(p *time.Duration, sectionName, name string, value time.Duration)
- func (c *ConfSet) Enum(sectionName, name string, value []string) *string
- func (c *ConfSet) EnumVar(p *string, sectionName, name string, value []string)
- func (c *ConfSet) Float64(sectionName, name string, value float64) *float64
- func (c *ConfSet) Float64Var(p *float64, sectionName, name string, value float64)
- func (c *ConfSet) Int(sectionName, name string, value int) *int
- func (c *ConfSet) Int64(sectionName, name string, value int64) *int64
- func (c *ConfSet) Int64Var(p *int64, sectionName, name string, value int64)
- func (c *ConfSet) IntVar(p *int, sectionName, name string, value int)
- func (c *ConfSet) Parse(in io.Reader) error
- func (c *ConfSet) String(sectionName, name string, value string) *string
- func (c *ConfSet) StringSlice(sectionName, name string, value []string) *[]string
- func (c *ConfSet) StringSliceVar(p *[]string, sectionName, name string, value []string)
- func (c *ConfSet) StringVar(p *string, sectionName, name string, value string)
- func (c *ConfSet) Uint(sectionName, name string, value uint) *uint
- func (c *ConfSet) Uint64(sectionName, name string, value uint64) *uint64
- func (c *ConfSet) Uint64Var(p *uint64, sectionName, name string, value uint64)
- func (c *ConfSet) UintVar(p *uint, sectionName, name string, value uint)
- func (c *ConfSet) Var(val Value, sectionName, name string)
- type Getter
- type Item
- type Section
- type Value
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RootSection ¶
func RootSection() string
Types ¶
type ConfSet ¶
type ConfSet struct {
// contains filtered or unexported fields
}
func NewConf ¶
func NewConf() *ConfSet
Example ¶
package main import ( "fmt" "log" "strings" "github.com/lucasepe/mini" ) func main() { data := ` width: 1600 subject: Computers,Education,Programming [background] art: shapes [title] text: Awesome Book! color: #000000 font-size: 160 offset: 0.3 ` conf := mini.NewConf() width := conf.Int("", "width", 1000) height := conf.Int("", "height", 1000) subject := conf.StringSlice("", "subject", []string{}) watermark := conf.String("", "watermark", "") art := conf.Enum("background", "art", []string{ "color-circles", "shapes", "circles-grid", "pixel-hole", "dots-wawe", "contour-line", "dot-line", "warp", }) err := conf.Parse(strings.NewReader(data)) if err != nil { log.Fatal(err) } fmt.Println(*width) fmt.Println(*height) for _, x := range *subject { fmt.Println(x) } fmt.Println(*watermark) fmt.Println(*art) }
Output: 1600 1000 Computers Education Programming shapes
func (*ConfSet) DurationVar ¶
func (*ConfSet) Float64Var ¶
func (*ConfSet) StringSlice ¶
func (*ConfSet) StringSliceVar ¶
type Getter ¶
Getter is an interface that allows the contents of a Value to be retrieved. It wraps the Value interface, rather than being part of it, because it appeared after Go 1 and its compatibility rules. All Value types provided by this package satisfy the Getter interface.
Click to show internal directories.
Click to hide internal directories.