Skip to content

minph/conf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

conf

A golang package for reading config file

Import package

import "github.com/minph/conf"

type Reader

type Reader struct {
    // Value data
    Value map[string]string

    // Path the config file path
    Path string

    // Delimiter the delimiter between groupname and keyname
    // default as ":"
    Delimiter string

    // Group the groupName list
    Group []string
}

Reader info struct of config file

func New

func New(path string) *Reader

New to create a Reader

will do UpdateContent() automatically

func (*Reader) Get

func (r *Reader) Get(groupName, itemName string) (value string, key string, err error)

Get value by using groupname and keyname

func (*Reader) GetItems

func (r *Reader) GetItems(itemName string) []string

GetItems will return all suited itemnames from all groupnames

func (*Reader) GetValue

func (r *Reader) GetValue(groupName, itemName string) string

GetValue Get value by using GroupName & KeyName

Force return a value which is "" default

func (*Reader) UpdateContent

func (r *Reader) UpdateContent()

UpdateContent update data from path will provide path data for conf.Reader

About

A golang package for reading config file

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages