allow dots in config set

This commit is contained in:
deads2k
2015-02-10 10:00:24 -05:00
parent a84e94574f
commit 2dcaab75f5
5 changed files with 267 additions and 42 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package util
import (
"reflect"
"sort"
)
@@ -32,6 +33,18 @@ func NewStringSet(items ...string) StringSet {
return ss
}
// KeySet creates a StringSet from a keys of a map[string](? extends interface{}). Since you can't describe that map type in the Go type system
// the reflected value is required.
func KeySet(theMap reflect.Value) StringSet {
ret := StringSet{}
for _, keyValue := range theMap.MapKeys() {
ret.Insert(keyValue.String())
}
return ret
}
// Insert adds items to the set.
func (s StringSet) Insert(items ...string) {
for _, item := range items {