29 lines
464 B
Go
29 lines
464 B
Go
package main
|
|
|
|
type Bundle map[string]interface{}
|
|
|
|
func (b Bundle) setValue(key string, val interface{}) {
|
|
b[key] = val
|
|
}
|
|
|
|
func (b Bundle) getBool(key string, def bool) bool {
|
|
if v, ok := b[key].(bool); ok {
|
|
return v
|
|
}
|
|
return def
|
|
}
|
|
|
|
func (b Bundle) getString(key, def string) string {
|
|
if v, ok := b[key].(string); ok {
|
|
return v
|
|
}
|
|
return def
|
|
}
|
|
|
|
func (b Bundle) getInt(key string, def int) int {
|
|
if v, ok := b[key].(int); ok {
|
|
return v
|
|
}
|
|
return def
|
|
}
|