config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DEFAULT_SECTION     = "default"
	DEFAULT_COMMENT     = []byte{'#'}
	DEFAULT_COMMENT_SEM = []byte{';'}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// map is not safe.
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Config) AddConfig

func (c *Config) AddConfig(section string, option string, value string) bool

AddConfig adds a new section->key:value to the configuration.

func (*Config) Bool

func (c *Config) Bool(key string) (bool, error)

func (*Config) Float64

func (c *Config) Float64(key string) (float64, error)

func (*Config) Int

func (c *Config) Int(key string) (int, error)

func (*Config) Int64

func (c *Config) Int64(key string) (int64, error)

func (*Config) Set

func (c *Config) Set(key string, value string) error

func (*Config) String

func (c *Config) String(key string) string

func (*Config) Strings

func (c *Config) Strings(key string) []string

type ConfigInterface

type ConfigInterface interface {
	String(key string) string
	Strings(key string) []string
	Bool(key string) (bool, error)
	Int(key string) (int, error)
	Int64(key string) (int64, error)
	Float64(key string) (float64, error)
	Set(key string, value string) error
}

func NewConfig

func NewConfig(confName string) (ConfigInterface, error)

NewConfig create an empty configuration representation.

func NewConfigFromText added in v0.9.0

func NewConfigFromText(text string) (ConfigInterface, error)

NewConfig create an empty configuration representation.

Jump to

Keyboard shortcuts

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