File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -17,3 +17,36 @@ func (vals Values) Get(k string) string {
17
17
}
18
18
return ""
19
19
}
20
+
21
+ //GetSize returns the number of values for an attribute at a key.
22
+ //Returns '0' in case of error or if key is not found.
23
+ func (vals Values ) GetSize (k string ) int {
24
+ if vals == nil {
25
+ return 0
26
+ }
27
+
28
+ v , ok := vals [k ]
29
+ if ok {
30
+ return len (v .Values )
31
+ }
32
+
33
+ return 0
34
+ }
35
+
36
+ //GetAll returns all the values for an attribute at a key.
37
+ //Returns an empty slice in case of error of if key is not found.
38
+ func (vals Values ) GetAll (k string ) []string {
39
+ var av []string
40
+
41
+ if vals == nil {
42
+ return av
43
+ }
44
+
45
+ if v , ok := vals [k ]; ok && len (v .Values ) > 0 {
46
+ for i := 0 ; i < len (v .Values ); i ++ {
47
+ av = append (av , string (v .Values [i ].Value ))
48
+ }
49
+ }
50
+
51
+ return av
52
+ }
You can’t perform that action at this time.
0 commit comments