@@ -67,14 +67,14 @@ func groupByKeys(entries []*RuntimeContainer, key string) []string {
6767}
6868
6969// Generalized where function
70- func generalizedWhere (entries interface {}, key string , test func (interface {}) bool ) (interface {}, error ) {
70+ func generalizedWhere (funcName string , entries interface {}, key string , test func (interface {}) bool ) (interface {}, error ) {
7171 entriesVal := reflect .ValueOf (entries )
7272
7373 switch entriesVal .Kind () {
7474 case reflect .Array , reflect .Slice :
7575 break
7676 default :
77- return nil , fmt .Errorf ("Must pass an array or slice to 'where '; received %v" , entries )
77+ return nil , fmt .Errorf ("Must pass an array or slice to '%s '; received %v" , funcName , entries )
7878 }
7979
8080 selection := make ([]interface {}, 0 )
@@ -92,28 +92,28 @@ func generalizedWhere(entries interface{}, key string, test func(interface{}) bo
9292
9393// selects entries based on key
9494func where (entries interface {}, key string , cmp interface {}) (interface {}, error ) {
95- return generalizedWhere (entries , key , func (value interface {}) bool {
95+ return generalizedWhere ("where" , entries , key , func (value interface {}) bool {
9696 return reflect .DeepEqual (value , cmp )
9797 })
9898}
9999
100100// selects entries where a key exists
101101func whereExist (entries interface {}, key string ) (interface {}, error ) {
102- return generalizedWhere (entries , key , func (value interface {}) bool {
102+ return generalizedWhere ("whereExist" , entries , key , func (value interface {}) bool {
103103 return value != nil
104104 })
105105}
106106
107107// selects entries where a key does not exist
108108func whereNotExist (entries interface {}, key string ) (interface {}, error ) {
109- return generalizedWhere (entries , key , func (value interface {}) bool {
109+ return generalizedWhere ("whereNotExist" , entries , key , func (value interface {}) bool {
110110 return value == nil
111111 })
112112}
113113
114114// selects entries based on key. Assumes key is delimited and breaks it apart before comparing
115115func whereAny (entries interface {}, key , sep string , cmp []string ) (interface {}, error ) {
116- return generalizedWhere (entries , key , func (value interface {}) bool {
116+ return generalizedWhere ("whereAny" , entries , key , func (value interface {}) bool {
117117 if value == nil {
118118 return false
119119 } else {
@@ -126,7 +126,7 @@ func whereAny(entries interface{}, key, sep string, cmp []string) (interface{},
126126// selects entries based on key. Assumes key is delimited and breaks it apart before comparing
127127func whereAll (entries interface {}, key , sep string , cmp []string ) (interface {}, error ) {
128128 req_count := len (cmp )
129- return generalizedWhere (entries , key , func (value interface {}) bool {
129+ return generalizedWhere ("whereAll" , entries , key , func (value interface {}) bool {
130130 if value == nil {
131131 return false
132132 } else {
0 commit comments