vconfig

package module
v0.0.0-...-39d5751 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: MIT Imports: 4 Imported by: 4

README

vconfig

reading and writing to config

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Section

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

func NewSection

func NewSection(name string) *Section

Create empty stand-alone section

func (*Section) AddValues

func (sec *Section) AddValues(name string, values []string)

add values to variable. extend list of old values with new ones

func (*Section) ClearContent

func (sec *Section) ClearContent()

clears content of section keeping name unchanged

func (*Section) Duplicate

func (sec *Section) Duplicate() *Section

create a copy of existing section

func (*Section) GetSingleValue

func (sec *Section) GetSingleValue(name string, default_value string) (string, error)

func (*Section) GetValues

func (sec *Section) GetValues(name string) ([]string, error)

return string array containing values of particular variable

func (*Section) GetVariables

func (sec *Section) GetVariables() []string

returns list of variables from section

func (*Section) Merge

func (secto *Section) Merge(secfrom *Section)

Merges content of secfrom to secto section

func (*Section) Name

func (sec *Section) Name() string

func (*Section) SetValues

func (sec *Section) SetValues(name string, values []string)

assign values to variable; rewrite old values

func (*Section) ToString

func (sec *Section) ToString() string

return section's content as string

type VConfig

type VConfig []*Section

func FromFile

func FromFile(filename string) (VConfig, error)

Loads data to VCOnfig from file

func New

func New(filename string) (VConfig, error)

Creates new VConfig object b

func (*VConfig) AddSection

func (vc *VConfig) AddSection(sec *Section) error

Adds stand-alone section to existing VConfig

func (*VConfig) FromString

func (vc *VConfig) FromString(str string) error

Loads data to VConfig from string

func (*VConfig) GetSections

func (vc *VConfig) GetSections(name string) ([]*Section, error)

return section(s) based on its name

func (*VConfig) GetSectionsByName

func (vc *VConfig) GetSectionsByName(name string) ([]*Section, error)

Wrapper for GetSections()

func (*VConfig) GetSectionsByVar

func (vc *VConfig) GetSectionsByVar(secName, varName, varValue string) ([]*Section, error)

func (*VConfig) GetSingleValue

func (vc *VConfig) GetSingleValue(sec_name string, var_name string, default_val string) (string, error)

Return single value

func (*VConfig) Merge

func (vcto *VConfig) Merge(vcfrom VConfig)

func (*VConfig) NewSection

func (vc *VConfig) NewSection(name string) *Section

Creates new section and adds it to VConfig

func (*VConfig) ToFile

func (vc *VConfig) ToFile(fname string) error

Write content of VCOnfig to file

func (*VConfig) ToString

func (vc *VConfig) ToString() string

return content of VConfig as string

Jump to

Keyboard shortcuts

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