Documentation
¶
Index ¶
- type Repository
- func (r *Repository) All() map[string]interface{}
- func (r *Repository) Get(key string) interface{}
- func (r *Repository) GetDefault(key string, defaultVal interface{}) interface{}
- func (r *Repository) Has(key string) bool
- func (r *Repository) Set(key string, value interface{}) *Repository
- func (r *Repository) SetMultiple(values map[string]interface{}) *Repository
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.