config

package
v0.0.0-...-696a884 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2014 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config implements configuration file support for Sleepy. The files are loaded using Load and parsed using the various parsing methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config map[string]map[string]interface{}

Config represents a parsed configuration file.

func Load

func Load(conf string) (*Config, error)

Load reads the configuration file located in 'conf' and returns a new Config type. If the configuration file cannot be found, the function returns nil and an error message.

func Merge

func Merge(conf ...*Config) (*Config, error)

Merge merges two or more configuration files, and returns a new, combined *Config type. Identical sections and options are overwritten according to the order of definition.

func (*Config) B

func (c *Config) B(section, option string) bool

B is like Bool, but never returns an error.

func (*Config) Bool

func (c *Config) Bool(section, option string) (bool, error)

Bool returns a value of 'option' in 'section' as an boolean. It returns 'false' along with an error message on failure.

func (*Config) F

func (c *Config) F(section, option string) float64

F is like Float, but never returns an error.

func (*Config) Float

func (c *Config) Float(section, option string) (float64, error)

Float returns a value of 'option' in 'section' as an float64. It returns 0.0 along with an error message on failure.

func (*Config) I

func (c *Config) I(section, option string) int64

I is like Int, but never returns an error.

func (*Config) Int

func (c *Config) Int(section, option string) (int64, error)

Int returns a value of 'option' in 'section' as an integer. It returns a zero (0) integer along with an error message on failure.

func (*Config) S

func (c *Config) S(section, option string) string

S is like String, but never returns an error.

func (*Config) String

func (c *Config) String(section, option string) (string, error)

String returns a value of 'option' in 'section' as a string. If the value cannot be found, or it cannot be converted into a string, an empty string is returned along with an error.

Jump to

Keyboard shortcuts

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