config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

Repository can be used as a simple container for storing key => value configuration pairs.

func NewPopulatedRepository

func NewPopulatedRepository(items map[string]interface{}) *Repository

NewPopulatedRepository will create a new configuration repository containing the supplied key => value pairs.

func NewRepository

func NewRepository() *Repository

NewRepository will create a new empty configuration repository.

func (*Repository) All

func (r *Repository) All() map[string]interface{}

All returns all items bound in the repository.

func (*Repository) Get

func (r *Repository) Get(key string) interface{}

Get can be used to receive a value for the given key from the repository and returns nil if not found.

func (*Repository) GetDefault

func (r *Repository) GetDefault(key string, defaultVal interface{}) interface{}

GetDefault can be used to receive a value for the given key from the repository and returns the supplied default value if not found.

func (*Repository) Has

func (r *Repository) Has(key string) bool

Has can be used to check if a key exists inside the repository.

func (*Repository) Set

func (r *Repository) Set(key string, value interface{}) *Repository

Set adds a key => value pair to the repository.

func (*Repository) SetMultiple

func (r *Repository) SetMultiple(values map[string]interface{}) *Repository

SetMultiple can be used to add multiple key => value pairs to the repository.

Jump to

Keyboard shortcuts

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