OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / stretchr / testify / vendor / github.com / stretchr / objx / type_specific_codegen.go
1 package objx
2
3 /*
4         Inter (interface{} and []interface{})
5         --------------------------------------------------
6 */
7
8 // Inter gets the value as a interface{}, returns the optionalDefault
9 // value or a system default object if the value is the wrong type.
10 func (v *Value) Inter(optionalDefault ...interface{}) interface{} {
11         if s, ok := v.data.(interface{}); ok {
12                 return s
13         }
14         if len(optionalDefault) == 1 {
15                 return optionalDefault[0]
16         }
17         return nil
18 }
19
20 // MustInter gets the value as a interface{}.
21 //
22 // Panics if the object is not a interface{}.
23 func (v *Value) MustInter() interface{} {
24         return v.data.(interface{})
25 }
26
27 // InterSlice gets the value as a []interface{}, returns the optionalDefault
28 // value or nil if the value is not a []interface{}.
29 func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} {
30         if s, ok := v.data.([]interface{}); ok {
31                 return s
32         }
33         if len(optionalDefault) == 1 {
34                 return optionalDefault[0]
35         }
36         return nil
37 }
38
39 // MustInterSlice gets the value as a []interface{}.
40 //
41 // Panics if the object is not a []interface{}.
42 func (v *Value) MustInterSlice() []interface{} {
43         return v.data.([]interface{})
44 }
45
46 // IsInter gets whether the object contained is a interface{} or not.
47 func (v *Value) IsInter() bool {
48         _, ok := v.data.(interface{})
49         return ok
50 }
51
52 // IsInterSlice gets whether the object contained is a []interface{} or not.
53 func (v *Value) IsInterSlice() bool {
54         _, ok := v.data.([]interface{})
55         return ok
56 }
57
58 // EachInter calls the specified callback for each object
59 // in the []interface{}.
60 //
61 // Panics if the object is the wrong type.
62 func (v *Value) EachInter(callback func(int, interface{}) bool) *Value {
63
64         for index, val := range v.MustInterSlice() {
65                 carryon := callback(index, val)
66                 if carryon == false {
67                         break
68                 }
69         }
70
71         return v
72
73 }
74
75 // WhereInter uses the specified decider function to select items
76 // from the []interface{}.  The object contained in the result will contain
77 // only the selected items.
78 func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value {
79
80         var selected []interface{}
81
82         v.EachInter(func(index int, val interface{}) bool {
83                 shouldSelect := decider(index, val)
84                 if shouldSelect == false {
85                         selected = append(selected, val)
86                 }
87                 return true
88         })
89
90         return &Value{data: selected}
91
92 }
93
94 // GroupInter uses the specified grouper function to group the items
95 // keyed by the return of the grouper.  The object contained in the
96 // result will contain a map[string][]interface{}.
97 func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value {
98
99         groups := make(map[string][]interface{})
100
101         v.EachInter(func(index int, val interface{}) bool {
102                 group := grouper(index, val)
103                 if _, ok := groups[group]; !ok {
104                         groups[group] = make([]interface{}, 0)
105                 }
106                 groups[group] = append(groups[group], val)
107                 return true
108         })
109
110         return &Value{data: groups}
111
112 }
113
114 // ReplaceInter uses the specified function to replace each interface{}s
115 // by iterating each item.  The data in the returned result will be a
116 // []interface{} containing the replaced items.
117 func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value {
118
119         arr := v.MustInterSlice()
120         replaced := make([]interface{}, len(arr))
121
122         v.EachInter(func(index int, val interface{}) bool {
123                 replaced[index] = replacer(index, val)
124                 return true
125         })
126
127         return &Value{data: replaced}
128
129 }
130
131 // CollectInter uses the specified collector function to collect a value
132 // for each of the interface{}s in the slice.  The data returned will be a
133 // []interface{}.
134 func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value {
135
136         arr := v.MustInterSlice()
137         collected := make([]interface{}, len(arr))
138
139         v.EachInter(func(index int, val interface{}) bool {
140                 collected[index] = collector(index, val)
141                 return true
142         })
143
144         return &Value{data: collected}
145 }
146
147 /*
148         MSI (map[string]interface{} and []map[string]interface{})
149         --------------------------------------------------
150 */
151
152 // MSI gets the value as a map[string]interface{}, returns the optionalDefault
153 // value or a system default object if the value is the wrong type.
154 func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} {
155         if s, ok := v.data.(map[string]interface{}); ok {
156                 return s
157         }
158         if len(optionalDefault) == 1 {
159                 return optionalDefault[0]
160         }
161         return nil
162 }
163
164 // MustMSI gets the value as a map[string]interface{}.
165 //
166 // Panics if the object is not a map[string]interface{}.
167 func (v *Value) MustMSI() map[string]interface{} {
168         return v.data.(map[string]interface{})
169 }
170
171 // MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault
172 // value or nil if the value is not a []map[string]interface{}.
173 func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} {
174         if s, ok := v.data.([]map[string]interface{}); ok {
175                 return s
176         }
177         if len(optionalDefault) == 1 {
178                 return optionalDefault[0]
179         }
180         return nil
181 }
182
183 // MustMSISlice gets the value as a []map[string]interface{}.
184 //
185 // Panics if the object is not a []map[string]interface{}.
186 func (v *Value) MustMSISlice() []map[string]interface{} {
187         return v.data.([]map[string]interface{})
188 }
189
190 // IsMSI gets whether the object contained is a map[string]interface{} or not.
191 func (v *Value) IsMSI() bool {
192         _, ok := v.data.(map[string]interface{})
193         return ok
194 }
195
196 // IsMSISlice gets whether the object contained is a []map[string]interface{} or not.
197 func (v *Value) IsMSISlice() bool {
198         _, ok := v.data.([]map[string]interface{})
199         return ok
200 }
201
202 // EachMSI calls the specified callback for each object
203 // in the []map[string]interface{}.
204 //
205 // Panics if the object is the wrong type.
206 func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value {
207
208         for index, val := range v.MustMSISlice() {
209                 carryon := callback(index, val)
210                 if carryon == false {
211                         break
212                 }
213         }
214
215         return v
216
217 }
218
219 // WhereMSI uses the specified decider function to select items
220 // from the []map[string]interface{}.  The object contained in the result will contain
221 // only the selected items.
222 func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value {
223
224         var selected []map[string]interface{}
225
226         v.EachMSI(func(index int, val map[string]interface{}) bool {
227                 shouldSelect := decider(index, val)
228                 if shouldSelect == false {
229                         selected = append(selected, val)
230                 }
231                 return true
232         })
233
234         return &Value{data: selected}
235
236 }
237
238 // GroupMSI uses the specified grouper function to group the items
239 // keyed by the return of the grouper.  The object contained in the
240 // result will contain a map[string][]map[string]interface{}.
241 func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value {
242
243         groups := make(map[string][]map[string]interface{})
244
245         v.EachMSI(func(index int, val map[string]interface{}) bool {
246                 group := grouper(index, val)
247                 if _, ok := groups[group]; !ok {
248                         groups[group] = make([]map[string]interface{}, 0)
249                 }
250                 groups[group] = append(groups[group], val)
251                 return true
252         })
253
254         return &Value{data: groups}
255
256 }
257
258 // ReplaceMSI uses the specified function to replace each map[string]interface{}s
259 // by iterating each item.  The data in the returned result will be a
260 // []map[string]interface{} containing the replaced items.
261 func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value {
262
263         arr := v.MustMSISlice()
264         replaced := make([]map[string]interface{}, len(arr))
265
266         v.EachMSI(func(index int, val map[string]interface{}) bool {
267                 replaced[index] = replacer(index, val)
268                 return true
269         })
270
271         return &Value{data: replaced}
272
273 }
274
275 // CollectMSI uses the specified collector function to collect a value
276 // for each of the map[string]interface{}s in the slice.  The data returned will be a
277 // []interface{}.
278 func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value {
279
280         arr := v.MustMSISlice()
281         collected := make([]interface{}, len(arr))
282
283         v.EachMSI(func(index int, val map[string]interface{}) bool {
284                 collected[index] = collector(index, val)
285                 return true
286         })
287
288         return &Value{data: collected}
289 }
290
291 /*
292         ObjxMap ((Map) and [](Map))
293         --------------------------------------------------
294 */
295
296 // ObjxMap gets the value as a (Map), returns the optionalDefault
297 // value or a system default object if the value is the wrong type.
298 func (v *Value) ObjxMap(optionalDefault ...(Map)) Map {
299         if s, ok := v.data.((Map)); ok {
300                 return s
301         }
302         if len(optionalDefault) == 1 {
303                 return optionalDefault[0]
304         }
305         return New(nil)
306 }
307
308 // MustObjxMap gets the value as a (Map).
309 //
310 // Panics if the object is not a (Map).
311 func (v *Value) MustObjxMap() Map {
312         return v.data.((Map))
313 }
314
315 // ObjxMapSlice gets the value as a [](Map), returns the optionalDefault
316 // value or nil if the value is not a [](Map).
317 func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) {
318         if s, ok := v.data.([](Map)); ok {
319                 return s
320         }
321         if len(optionalDefault) == 1 {
322                 return optionalDefault[0]
323         }
324         return nil
325 }
326
327 // MustObjxMapSlice gets the value as a [](Map).
328 //
329 // Panics if the object is not a [](Map).
330 func (v *Value) MustObjxMapSlice() [](Map) {
331         return v.data.([](Map))
332 }
333
334 // IsObjxMap gets whether the object contained is a (Map) or not.
335 func (v *Value) IsObjxMap() bool {
336         _, ok := v.data.((Map))
337         return ok
338 }
339
340 // IsObjxMapSlice gets whether the object contained is a [](Map) or not.
341 func (v *Value) IsObjxMapSlice() bool {
342         _, ok := v.data.([](Map))
343         return ok
344 }
345
346 // EachObjxMap calls the specified callback for each object
347 // in the [](Map).
348 //
349 // Panics if the object is the wrong type.
350 func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value {
351
352         for index, val := range v.MustObjxMapSlice() {
353                 carryon := callback(index, val)
354                 if carryon == false {
355                         break
356                 }
357         }
358
359         return v
360
361 }
362
363 // WhereObjxMap uses the specified decider function to select items
364 // from the [](Map).  The object contained in the result will contain
365 // only the selected items.
366 func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value {
367
368         var selected [](Map)
369
370         v.EachObjxMap(func(index int, val Map) bool {
371                 shouldSelect := decider(index, val)
372                 if shouldSelect == false {
373                         selected = append(selected, val)
374                 }
375                 return true
376         })
377
378         return &Value{data: selected}
379
380 }
381
382 // GroupObjxMap uses the specified grouper function to group the items
383 // keyed by the return of the grouper.  The object contained in the
384 // result will contain a map[string][](Map).
385 func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value {
386
387         groups := make(map[string][](Map))
388
389         v.EachObjxMap(func(index int, val Map) bool {
390                 group := grouper(index, val)
391                 if _, ok := groups[group]; !ok {
392                         groups[group] = make([](Map), 0)
393                 }
394                 groups[group] = append(groups[group], val)
395                 return true
396         })
397
398         return &Value{data: groups}
399
400 }
401
402 // ReplaceObjxMap uses the specified function to replace each (Map)s
403 // by iterating each item.  The data in the returned result will be a
404 // [](Map) containing the replaced items.
405 func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value {
406
407         arr := v.MustObjxMapSlice()
408         replaced := make([](Map), len(arr))
409
410         v.EachObjxMap(func(index int, val Map) bool {
411                 replaced[index] = replacer(index, val)
412                 return true
413         })
414
415         return &Value{data: replaced}
416
417 }
418
419 // CollectObjxMap uses the specified collector function to collect a value
420 // for each of the (Map)s in the slice.  The data returned will be a
421 // []interface{}.
422 func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value {
423
424         arr := v.MustObjxMapSlice()
425         collected := make([]interface{}, len(arr))
426
427         v.EachObjxMap(func(index int, val Map) bool {
428                 collected[index] = collector(index, val)
429                 return true
430         })
431
432         return &Value{data: collected}
433 }
434
435 /*
436         Bool (bool and []bool)
437         --------------------------------------------------
438 */
439
440 // Bool gets the value as a bool, returns the optionalDefault
441 // value or a system default object if the value is the wrong type.
442 func (v *Value) Bool(optionalDefault ...bool) bool {
443         if s, ok := v.data.(bool); ok {
444                 return s
445         }
446         if len(optionalDefault) == 1 {
447                 return optionalDefault[0]
448         }
449         return false
450 }
451
452 // MustBool gets the value as a bool.
453 //
454 // Panics if the object is not a bool.
455 func (v *Value) MustBool() bool {
456         return v.data.(bool)
457 }
458
459 // BoolSlice gets the value as a []bool, returns the optionalDefault
460 // value or nil if the value is not a []bool.
461 func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool {
462         if s, ok := v.data.([]bool); ok {
463                 return s
464         }
465         if len(optionalDefault) == 1 {
466                 return optionalDefault[0]
467         }
468         return nil
469 }
470
471 // MustBoolSlice gets the value as a []bool.
472 //
473 // Panics if the object is not a []bool.
474 func (v *Value) MustBoolSlice() []bool {
475         return v.data.([]bool)
476 }
477
478 // IsBool gets whether the object contained is a bool or not.
479 func (v *Value) IsBool() bool {
480         _, ok := v.data.(bool)
481         return ok
482 }
483
484 // IsBoolSlice gets whether the object contained is a []bool or not.
485 func (v *Value) IsBoolSlice() bool {
486         _, ok := v.data.([]bool)
487         return ok
488 }
489
490 // EachBool calls the specified callback for each object
491 // in the []bool.
492 //
493 // Panics if the object is the wrong type.
494 func (v *Value) EachBool(callback func(int, bool) bool) *Value {
495
496         for index, val := range v.MustBoolSlice() {
497                 carryon := callback(index, val)
498                 if carryon == false {
499                         break
500                 }
501         }
502
503         return v
504
505 }
506
507 // WhereBool uses the specified decider function to select items
508 // from the []bool.  The object contained in the result will contain
509 // only the selected items.
510 func (v *Value) WhereBool(decider func(int, bool) bool) *Value {
511
512         var selected []bool
513
514         v.EachBool(func(index int, val bool) bool {
515                 shouldSelect := decider(index, val)
516                 if shouldSelect == false {
517                         selected = append(selected, val)
518                 }
519                 return true
520         })
521
522         return &Value{data: selected}
523
524 }
525
526 // GroupBool uses the specified grouper function to group the items
527 // keyed by the return of the grouper.  The object contained in the
528 // result will contain a map[string][]bool.
529 func (v *Value) GroupBool(grouper func(int, bool) string) *Value {
530
531         groups := make(map[string][]bool)
532
533         v.EachBool(func(index int, val bool) bool {
534                 group := grouper(index, val)
535                 if _, ok := groups[group]; !ok {
536                         groups[group] = make([]bool, 0)
537                 }
538                 groups[group] = append(groups[group], val)
539                 return true
540         })
541
542         return &Value{data: groups}
543
544 }
545
546 // ReplaceBool uses the specified function to replace each bools
547 // by iterating each item.  The data in the returned result will be a
548 // []bool containing the replaced items.
549 func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value {
550
551         arr := v.MustBoolSlice()
552         replaced := make([]bool, len(arr))
553
554         v.EachBool(func(index int, val bool) bool {
555                 replaced[index] = replacer(index, val)
556                 return true
557         })
558
559         return &Value{data: replaced}
560
561 }
562
563 // CollectBool uses the specified collector function to collect a value
564 // for each of the bools in the slice.  The data returned will be a
565 // []interface{}.
566 func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value {
567
568         arr := v.MustBoolSlice()
569         collected := make([]interface{}, len(arr))
570
571         v.EachBool(func(index int, val bool) bool {
572                 collected[index] = collector(index, val)
573                 return true
574         })
575
576         return &Value{data: collected}
577 }
578
579 /*
580         Str (string and []string)
581         --------------------------------------------------
582 */
583
584 // Str gets the value as a string, returns the optionalDefault
585 // value or a system default object if the value is the wrong type.
586 func (v *Value) Str(optionalDefault ...string) string {
587         if s, ok := v.data.(string); ok {
588                 return s
589         }
590         if len(optionalDefault) == 1 {
591                 return optionalDefault[0]
592         }
593         return ""
594 }
595
596 // MustStr gets the value as a string.
597 //
598 // Panics if the object is not a string.
599 func (v *Value) MustStr() string {
600         return v.data.(string)
601 }
602
603 // StrSlice gets the value as a []string, returns the optionalDefault
604 // value or nil if the value is not a []string.
605 func (v *Value) StrSlice(optionalDefault ...[]string) []string {
606         if s, ok := v.data.([]string); ok {
607                 return s
608         }
609         if len(optionalDefault) == 1 {
610                 return optionalDefault[0]
611         }
612         return nil
613 }
614
615 // MustStrSlice gets the value as a []string.
616 //
617 // Panics if the object is not a []string.
618 func (v *Value) MustStrSlice() []string {
619         return v.data.([]string)
620 }
621
622 // IsStr gets whether the object contained is a string or not.
623 func (v *Value) IsStr() bool {
624         _, ok := v.data.(string)
625         return ok
626 }
627
628 // IsStrSlice gets whether the object contained is a []string or not.
629 func (v *Value) IsStrSlice() bool {
630         _, ok := v.data.([]string)
631         return ok
632 }
633
634 // EachStr calls the specified callback for each object
635 // in the []string.
636 //
637 // Panics if the object is the wrong type.
638 func (v *Value) EachStr(callback func(int, string) bool) *Value {
639
640         for index, val := range v.MustStrSlice() {
641                 carryon := callback(index, val)
642                 if carryon == false {
643                         break
644                 }
645         }
646
647         return v
648
649 }
650
651 // WhereStr uses the specified decider function to select items
652 // from the []string.  The object contained in the result will contain
653 // only the selected items.
654 func (v *Value) WhereStr(decider func(int, string) bool) *Value {
655
656         var selected []string
657
658         v.EachStr(func(index int, val string) bool {
659                 shouldSelect := decider(index, val)
660                 if shouldSelect == false {
661                         selected = append(selected, val)
662                 }
663                 return true
664         })
665
666         return &Value{data: selected}
667
668 }
669
670 // GroupStr uses the specified grouper function to group the items
671 // keyed by the return of the grouper.  The object contained in the
672 // result will contain a map[string][]string.
673 func (v *Value) GroupStr(grouper func(int, string) string) *Value {
674
675         groups := make(map[string][]string)
676
677         v.EachStr(func(index int, val string) bool {
678                 group := grouper(index, val)
679                 if _, ok := groups[group]; !ok {
680                         groups[group] = make([]string, 0)
681                 }
682                 groups[group] = append(groups[group], val)
683                 return true
684         })
685
686         return &Value{data: groups}
687
688 }
689
690 // ReplaceStr uses the specified function to replace each strings
691 // by iterating each item.  The data in the returned result will be a
692 // []string containing the replaced items.
693 func (v *Value) ReplaceStr(replacer func(int, string) string) *Value {
694
695         arr := v.MustStrSlice()
696         replaced := make([]string, len(arr))
697
698         v.EachStr(func(index int, val string) bool {
699                 replaced[index] = replacer(index, val)
700                 return true
701         })
702
703         return &Value{data: replaced}
704
705 }
706
707 // CollectStr uses the specified collector function to collect a value
708 // for each of the strings in the slice.  The data returned will be a
709 // []interface{}.
710 func (v *Value) CollectStr(collector func(int, string) interface{}) *Value {
711
712         arr := v.MustStrSlice()
713         collected := make([]interface{}, len(arr))
714
715         v.EachStr(func(index int, val string) bool {
716                 collected[index] = collector(index, val)
717                 return true
718         })
719
720         return &Value{data: collected}
721 }
722
723 /*
724         Int (int and []int)
725         --------------------------------------------------
726 */
727
728 // Int gets the value as a int, returns the optionalDefault
729 // value or a system default object if the value is the wrong type.
730 func (v *Value) Int(optionalDefault ...int) int {
731         if s, ok := v.data.(int); ok {
732                 return s
733         }
734         if len(optionalDefault) == 1 {
735                 return optionalDefault[0]
736         }
737         return 0
738 }
739
740 // MustInt gets the value as a int.
741 //
742 // Panics if the object is not a int.
743 func (v *Value) MustInt() int {
744         return v.data.(int)
745 }
746
747 // IntSlice gets the value as a []int, returns the optionalDefault
748 // value or nil if the value is not a []int.
749 func (v *Value) IntSlice(optionalDefault ...[]int) []int {
750         if s, ok := v.data.([]int); ok {
751                 return s
752         }
753         if len(optionalDefault) == 1 {
754                 return optionalDefault[0]
755         }
756         return nil
757 }
758
759 // MustIntSlice gets the value as a []int.
760 //
761 // Panics if the object is not a []int.
762 func (v *Value) MustIntSlice() []int {
763         return v.data.([]int)
764 }
765
766 // IsInt gets whether the object contained is a int or not.
767 func (v *Value) IsInt() bool {
768         _, ok := v.data.(int)
769         return ok
770 }
771
772 // IsIntSlice gets whether the object contained is a []int or not.
773 func (v *Value) IsIntSlice() bool {
774         _, ok := v.data.([]int)
775         return ok
776 }
777
778 // EachInt calls the specified callback for each object
779 // in the []int.
780 //
781 // Panics if the object is the wrong type.
782 func (v *Value) EachInt(callback func(int, int) bool) *Value {
783
784         for index, val := range v.MustIntSlice() {
785                 carryon := callback(index, val)
786                 if carryon == false {
787                         break
788                 }
789         }
790
791         return v
792
793 }
794
795 // WhereInt uses the specified decider function to select items
796 // from the []int.  The object contained in the result will contain
797 // only the selected items.
798 func (v *Value) WhereInt(decider func(int, int) bool) *Value {
799
800         var selected []int
801
802         v.EachInt(func(index int, val int) bool {
803                 shouldSelect := decider(index, val)
804                 if shouldSelect == false {
805                         selected = append(selected, val)
806                 }
807                 return true
808         })
809
810         return &Value{data: selected}
811
812 }
813
814 // GroupInt uses the specified grouper function to group the items
815 // keyed by the return of the grouper.  The object contained in the
816 // result will contain a map[string][]int.
817 func (v *Value) GroupInt(grouper func(int, int) string) *Value {
818
819         groups := make(map[string][]int)
820
821         v.EachInt(func(index int, val int) bool {
822                 group := grouper(index, val)
823                 if _, ok := groups[group]; !ok {
824                         groups[group] = make([]int, 0)
825                 }
826                 groups[group] = append(groups[group], val)
827                 return true
828         })
829
830         return &Value{data: groups}
831
832 }
833
834 // ReplaceInt uses the specified function to replace each ints
835 // by iterating each item.  The data in the returned result will be a
836 // []int containing the replaced items.
837 func (v *Value) ReplaceInt(replacer func(int, int) int) *Value {
838
839         arr := v.MustIntSlice()
840         replaced := make([]int, len(arr))
841
842         v.EachInt(func(index int, val int) bool {
843                 replaced[index] = replacer(index, val)
844                 return true
845         })
846
847         return &Value{data: replaced}
848
849 }
850
851 // CollectInt uses the specified collector function to collect a value
852 // for each of the ints in the slice.  The data returned will be a
853 // []interface{}.
854 func (v *Value) CollectInt(collector func(int, int) interface{}) *Value {
855
856         arr := v.MustIntSlice()
857         collected := make([]interface{}, len(arr))
858
859         v.EachInt(func(index int, val int) bool {
860                 collected[index] = collector(index, val)
861                 return true
862         })
863
864         return &Value{data: collected}
865 }
866
867 /*
868         Int8 (int8 and []int8)
869         --------------------------------------------------
870 */
871
872 // Int8 gets the value as a int8, returns the optionalDefault
873 // value or a system default object if the value is the wrong type.
874 func (v *Value) Int8(optionalDefault ...int8) int8 {
875         if s, ok := v.data.(int8); ok {
876                 return s
877         }
878         if len(optionalDefault) == 1 {
879                 return optionalDefault[0]
880         }
881         return 0
882 }
883
884 // MustInt8 gets the value as a int8.
885 //
886 // Panics if the object is not a int8.
887 func (v *Value) MustInt8() int8 {
888         return v.data.(int8)
889 }
890
891 // Int8Slice gets the value as a []int8, returns the optionalDefault
892 // value or nil if the value is not a []int8.
893 func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 {
894         if s, ok := v.data.([]int8); ok {
895                 return s
896         }
897         if len(optionalDefault) == 1 {
898                 return optionalDefault[0]
899         }
900         return nil
901 }
902
903 // MustInt8Slice gets the value as a []int8.
904 //
905 // Panics if the object is not a []int8.
906 func (v *Value) MustInt8Slice() []int8 {
907         return v.data.([]int8)
908 }
909
910 // IsInt8 gets whether the object contained is a int8 or not.
911 func (v *Value) IsInt8() bool {
912         _, ok := v.data.(int8)
913         return ok
914 }
915
916 // IsInt8Slice gets whether the object contained is a []int8 or not.
917 func (v *Value) IsInt8Slice() bool {
918         _, ok := v.data.([]int8)
919         return ok
920 }
921
922 // EachInt8 calls the specified callback for each object
923 // in the []int8.
924 //
925 // Panics if the object is the wrong type.
926 func (v *Value) EachInt8(callback func(int, int8) bool) *Value {
927
928         for index, val := range v.MustInt8Slice() {
929                 carryon := callback(index, val)
930                 if carryon == false {
931                         break
932                 }
933         }
934
935         return v
936
937 }
938
939 // WhereInt8 uses the specified decider function to select items
940 // from the []int8.  The object contained in the result will contain
941 // only the selected items.
942 func (v *Value) WhereInt8(decider func(int, int8) bool) *Value {
943
944         var selected []int8
945
946         v.EachInt8(func(index int, val int8) bool {
947                 shouldSelect := decider(index, val)
948                 if shouldSelect == false {
949                         selected = append(selected, val)
950                 }
951                 return true
952         })
953
954         return &Value{data: selected}
955
956 }
957
958 // GroupInt8 uses the specified grouper function to group the items
959 // keyed by the return of the grouper.  The object contained in the
960 // result will contain a map[string][]int8.
961 func (v *Value) GroupInt8(grouper func(int, int8) string) *Value {
962
963         groups := make(map[string][]int8)
964
965         v.EachInt8(func(index int, val int8) bool {
966                 group := grouper(index, val)
967                 if _, ok := groups[group]; !ok {
968                         groups[group] = make([]int8, 0)
969                 }
970                 groups[group] = append(groups[group], val)
971                 return true
972         })
973
974         return &Value{data: groups}
975
976 }
977
978 // ReplaceInt8 uses the specified function to replace each int8s
979 // by iterating each item.  The data in the returned result will be a
980 // []int8 containing the replaced items.
981 func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value {
982
983         arr := v.MustInt8Slice()
984         replaced := make([]int8, len(arr))
985
986         v.EachInt8(func(index int, val int8) bool {
987                 replaced[index] = replacer(index, val)
988                 return true
989         })
990
991         return &Value{data: replaced}
992
993 }
994
995 // CollectInt8 uses the specified collector function to collect a value
996 // for each of the int8s in the slice.  The data returned will be a
997 // []interface{}.
998 func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value {
999
1000         arr := v.MustInt8Slice()
1001         collected := make([]interface{}, len(arr))
1002
1003         v.EachInt8(func(index int, val int8) bool {
1004                 collected[index] = collector(index, val)
1005                 return true
1006         })
1007
1008         return &Value{data: collected}
1009 }
1010
1011 /*
1012         Int16 (int16 and []int16)
1013         --------------------------------------------------
1014 */
1015
1016 // Int16 gets the value as a int16, returns the optionalDefault
1017 // value or a system default object if the value is the wrong type.
1018 func (v *Value) Int16(optionalDefault ...int16) int16 {
1019         if s, ok := v.data.(int16); ok {
1020                 return s
1021         }
1022         if len(optionalDefault) == 1 {
1023                 return optionalDefault[0]
1024         }
1025         return 0
1026 }
1027
1028 // MustInt16 gets the value as a int16.
1029 //
1030 // Panics if the object is not a int16.
1031 func (v *Value) MustInt16() int16 {
1032         return v.data.(int16)
1033 }
1034
1035 // Int16Slice gets the value as a []int16, returns the optionalDefault
1036 // value or nil if the value is not a []int16.
1037 func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 {
1038         if s, ok := v.data.([]int16); ok {
1039                 return s
1040         }
1041         if len(optionalDefault) == 1 {
1042                 return optionalDefault[0]
1043         }
1044         return nil
1045 }
1046
1047 // MustInt16Slice gets the value as a []int16.
1048 //
1049 // Panics if the object is not a []int16.
1050 func (v *Value) MustInt16Slice() []int16 {
1051         return v.data.([]int16)
1052 }
1053
1054 // IsInt16 gets whether the object contained is a int16 or not.
1055 func (v *Value) IsInt16() bool {
1056         _, ok := v.data.(int16)
1057         return ok
1058 }
1059
1060 // IsInt16Slice gets whether the object contained is a []int16 or not.
1061 func (v *Value) IsInt16Slice() bool {
1062         _, ok := v.data.([]int16)
1063         return ok
1064 }
1065
1066 // EachInt16 calls the specified callback for each object
1067 // in the []int16.
1068 //
1069 // Panics if the object is the wrong type.
1070 func (v *Value) EachInt16(callback func(int, int16) bool) *Value {
1071
1072         for index, val := range v.MustInt16Slice() {
1073                 carryon := callback(index, val)
1074                 if carryon == false {
1075                         break
1076                 }
1077         }
1078
1079         return v
1080
1081 }
1082
1083 // WhereInt16 uses the specified decider function to select items
1084 // from the []int16.  The object contained in the result will contain
1085 // only the selected items.
1086 func (v *Value) WhereInt16(decider func(int, int16) bool) *Value {
1087
1088         var selected []int16
1089
1090         v.EachInt16(func(index int, val int16) bool {
1091                 shouldSelect := decider(index, val)
1092                 if shouldSelect == false {
1093                         selected = append(selected, val)
1094                 }
1095                 return true
1096         })
1097
1098         return &Value{data: selected}
1099
1100 }
1101
1102 // GroupInt16 uses the specified grouper function to group the items
1103 // keyed by the return of the grouper.  The object contained in the
1104 // result will contain a map[string][]int16.
1105 func (v *Value) GroupInt16(grouper func(int, int16) string) *Value {
1106
1107         groups := make(map[string][]int16)
1108
1109         v.EachInt16(func(index int, val int16) bool {
1110                 group := grouper(index, val)
1111                 if _, ok := groups[group]; !ok {
1112                         groups[group] = make([]int16, 0)
1113                 }
1114                 groups[group] = append(groups[group], val)
1115                 return true
1116         })
1117
1118         return &Value{data: groups}
1119
1120 }
1121
1122 // ReplaceInt16 uses the specified function to replace each int16s
1123 // by iterating each item.  The data in the returned result will be a
1124 // []int16 containing the replaced items.
1125 func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value {
1126
1127         arr := v.MustInt16Slice()
1128         replaced := make([]int16, len(arr))
1129
1130         v.EachInt16(func(index int, val int16) bool {
1131                 replaced[index] = replacer(index, val)
1132                 return true
1133         })
1134
1135         return &Value{data: replaced}
1136
1137 }
1138
1139 // CollectInt16 uses the specified collector function to collect a value
1140 // for each of the int16s in the slice.  The data returned will be a
1141 // []interface{}.
1142 func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value {
1143
1144         arr := v.MustInt16Slice()
1145         collected := make([]interface{}, len(arr))
1146
1147         v.EachInt16(func(index int, val int16) bool {
1148                 collected[index] = collector(index, val)
1149                 return true
1150         })
1151
1152         return &Value{data: collected}
1153 }
1154
1155 /*
1156         Int32 (int32 and []int32)
1157         --------------------------------------------------
1158 */
1159
1160 // Int32 gets the value as a int32, returns the optionalDefault
1161 // value or a system default object if the value is the wrong type.
1162 func (v *Value) Int32(optionalDefault ...int32) int32 {
1163         if s, ok := v.data.(int32); ok {
1164                 return s
1165         }
1166         if len(optionalDefault) == 1 {
1167                 return optionalDefault[0]
1168         }
1169         return 0
1170 }
1171
1172 // MustInt32 gets the value as a int32.
1173 //
1174 // Panics if the object is not a int32.
1175 func (v *Value) MustInt32() int32 {
1176         return v.data.(int32)
1177 }
1178
1179 // Int32Slice gets the value as a []int32, returns the optionalDefault
1180 // value or nil if the value is not a []int32.
1181 func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 {
1182         if s, ok := v.data.([]int32); ok {
1183                 return s
1184         }
1185         if len(optionalDefault) == 1 {
1186                 return optionalDefault[0]
1187         }
1188         return nil
1189 }
1190
1191 // MustInt32Slice gets the value as a []int32.
1192 //
1193 // Panics if the object is not a []int32.
1194 func (v *Value) MustInt32Slice() []int32 {
1195         return v.data.([]int32)
1196 }
1197
1198 // IsInt32 gets whether the object contained is a int32 or not.
1199 func (v *Value) IsInt32() bool {
1200         _, ok := v.data.(int32)
1201         return ok
1202 }
1203
1204 // IsInt32Slice gets whether the object contained is a []int32 or not.
1205 func (v *Value) IsInt32Slice() bool {
1206         _, ok := v.data.([]int32)
1207         return ok
1208 }
1209
1210 // EachInt32 calls the specified callback for each object
1211 // in the []int32.
1212 //
1213 // Panics if the object is the wrong type.
1214 func (v *Value) EachInt32(callback func(int, int32) bool) *Value {
1215
1216         for index, val := range v.MustInt32Slice() {
1217                 carryon := callback(index, val)
1218                 if carryon == false {
1219                         break
1220                 }
1221         }
1222
1223         return v
1224
1225 }
1226
1227 // WhereInt32 uses the specified decider function to select items
1228 // from the []int32.  The object contained in the result will contain
1229 // only the selected items.
1230 func (v *Value) WhereInt32(decider func(int, int32) bool) *Value {
1231
1232         var selected []int32
1233
1234         v.EachInt32(func(index int, val int32) bool {
1235                 shouldSelect := decider(index, val)
1236                 if shouldSelect == false {
1237                         selected = append(selected, val)
1238                 }
1239                 return true
1240         })
1241
1242         return &Value{data: selected}
1243
1244 }
1245
1246 // GroupInt32 uses the specified grouper function to group the items
1247 // keyed by the return of the grouper.  The object contained in the
1248 // result will contain a map[string][]int32.
1249 func (v *Value) GroupInt32(grouper func(int, int32) string) *Value {
1250
1251         groups := make(map[string][]int32)
1252
1253         v.EachInt32(func(index int, val int32) bool {
1254                 group := grouper(index, val)
1255                 if _, ok := groups[group]; !ok {
1256                         groups[group] = make([]int32, 0)
1257                 }
1258                 groups[group] = append(groups[group], val)
1259                 return true
1260         })
1261
1262         return &Value{data: groups}
1263
1264 }
1265
1266 // ReplaceInt32 uses the specified function to replace each int32s
1267 // by iterating each item.  The data in the returned result will be a
1268 // []int32 containing the replaced items.
1269 func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value {
1270
1271         arr := v.MustInt32Slice()
1272         replaced := make([]int32, len(arr))
1273
1274         v.EachInt32(func(index int, val int32) bool {
1275                 replaced[index] = replacer(index, val)
1276                 return true
1277         })
1278
1279         return &Value{data: replaced}
1280
1281 }
1282
1283 // CollectInt32 uses the specified collector function to collect a value
1284 // for each of the int32s in the slice.  The data returned will be a
1285 // []interface{}.
1286 func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value {
1287
1288         arr := v.MustInt32Slice()
1289         collected := make([]interface{}, len(arr))
1290
1291         v.EachInt32(func(index int, val int32) bool {
1292                 collected[index] = collector(index, val)
1293                 return true
1294         })
1295
1296         return &Value{data: collected}
1297 }
1298
1299 /*
1300         Int64 (int64 and []int64)
1301         --------------------------------------------------
1302 */
1303
1304 // Int64 gets the value as a int64, returns the optionalDefault
1305 // value or a system default object if the value is the wrong type.
1306 func (v *Value) Int64(optionalDefault ...int64) int64 {
1307         if s, ok := v.data.(int64); ok {
1308                 return s
1309         }
1310         if len(optionalDefault) == 1 {
1311                 return optionalDefault[0]
1312         }
1313         return 0
1314 }
1315
1316 // MustInt64 gets the value as a int64.
1317 //
1318 // Panics if the object is not a int64.
1319 func (v *Value) MustInt64() int64 {
1320         return v.data.(int64)
1321 }
1322
1323 // Int64Slice gets the value as a []int64, returns the optionalDefault
1324 // value or nil if the value is not a []int64.
1325 func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 {
1326         if s, ok := v.data.([]int64); ok {
1327                 return s
1328         }
1329         if len(optionalDefault) == 1 {
1330                 return optionalDefault[0]
1331         }
1332         return nil
1333 }
1334
1335 // MustInt64Slice gets the value as a []int64.
1336 //
1337 // Panics if the object is not a []int64.
1338 func (v *Value) MustInt64Slice() []int64 {
1339         return v.data.([]int64)
1340 }
1341
1342 // IsInt64 gets whether the object contained is a int64 or not.
1343 func (v *Value) IsInt64() bool {
1344         _, ok := v.data.(int64)
1345         return ok
1346 }
1347
1348 // IsInt64Slice gets whether the object contained is a []int64 or not.
1349 func (v *Value) IsInt64Slice() bool {
1350         _, ok := v.data.([]int64)
1351         return ok
1352 }
1353
1354 // EachInt64 calls the specified callback for each object
1355 // in the []int64.
1356 //
1357 // Panics if the object is the wrong type.
1358 func (v *Value) EachInt64(callback func(int, int64) bool) *Value {
1359
1360         for index, val := range v.MustInt64Slice() {
1361                 carryon := callback(index, val)
1362                 if carryon == false {
1363                         break
1364                 }
1365         }
1366
1367         return v
1368
1369 }
1370
1371 // WhereInt64 uses the specified decider function to select items
1372 // from the []int64.  The object contained in the result will contain
1373 // only the selected items.
1374 func (v *Value) WhereInt64(decider func(int, int64) bool) *Value {
1375
1376         var selected []int64
1377
1378         v.EachInt64(func(index int, val int64) bool {
1379                 shouldSelect := decider(index, val)
1380                 if shouldSelect == false {
1381                         selected = append(selected, val)
1382                 }
1383                 return true
1384         })
1385
1386         return &Value{data: selected}
1387
1388 }
1389
1390 // GroupInt64 uses the specified grouper function to group the items
1391 // keyed by the return of the grouper.  The object contained in the
1392 // result will contain a map[string][]int64.
1393 func (v *Value) GroupInt64(grouper func(int, int64) string) *Value {
1394
1395         groups := make(map[string][]int64)
1396
1397         v.EachInt64(func(index int, val int64) bool {
1398                 group := grouper(index, val)
1399                 if _, ok := groups[group]; !ok {
1400                         groups[group] = make([]int64, 0)
1401                 }
1402                 groups[group] = append(groups[group], val)
1403                 return true
1404         })
1405
1406         return &Value{data: groups}
1407
1408 }
1409
1410 // ReplaceInt64 uses the specified function to replace each int64s
1411 // by iterating each item.  The data in the returned result will be a
1412 // []int64 containing the replaced items.
1413 func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value {
1414
1415         arr := v.MustInt64Slice()
1416         replaced := make([]int64, len(arr))
1417
1418         v.EachInt64(func(index int, val int64) bool {
1419                 replaced[index] = replacer(index, val)
1420                 return true
1421         })
1422
1423         return &Value{data: replaced}
1424
1425 }
1426
1427 // CollectInt64 uses the specified collector function to collect a value
1428 // for each of the int64s in the slice.  The data returned will be a
1429 // []interface{}.
1430 func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value {
1431
1432         arr := v.MustInt64Slice()
1433         collected := make([]interface{}, len(arr))
1434
1435         v.EachInt64(func(index int, val int64) bool {
1436                 collected[index] = collector(index, val)
1437                 return true
1438         })
1439
1440         return &Value{data: collected}
1441 }
1442
1443 /*
1444         Uint (uint and []uint)
1445         --------------------------------------------------
1446 */
1447
1448 // Uint gets the value as a uint, returns the optionalDefault
1449 // value or a system default object if the value is the wrong type.
1450 func (v *Value) Uint(optionalDefault ...uint) uint {
1451         if s, ok := v.data.(uint); ok {
1452                 return s
1453         }
1454         if len(optionalDefault) == 1 {
1455                 return optionalDefault[0]
1456         }
1457         return 0
1458 }
1459
1460 // MustUint gets the value as a uint.
1461 //
1462 // Panics if the object is not a uint.
1463 func (v *Value) MustUint() uint {
1464         return v.data.(uint)
1465 }
1466
1467 // UintSlice gets the value as a []uint, returns the optionalDefault
1468 // value or nil if the value is not a []uint.
1469 func (v *Value) UintSlice(optionalDefault ...[]uint) []uint {
1470         if s, ok := v.data.([]uint); ok {
1471                 return s
1472         }
1473         if len(optionalDefault) == 1 {
1474                 return optionalDefault[0]
1475         }
1476         return nil
1477 }
1478
1479 // MustUintSlice gets the value as a []uint.
1480 //
1481 // Panics if the object is not a []uint.
1482 func (v *Value) MustUintSlice() []uint {
1483         return v.data.([]uint)
1484 }
1485
1486 // IsUint gets whether the object contained is a uint or not.
1487 func (v *Value) IsUint() bool {
1488         _, ok := v.data.(uint)
1489         return ok
1490 }
1491
1492 // IsUintSlice gets whether the object contained is a []uint or not.
1493 func (v *Value) IsUintSlice() bool {
1494         _, ok := v.data.([]uint)
1495         return ok
1496 }
1497
1498 // EachUint calls the specified callback for each object
1499 // in the []uint.
1500 //
1501 // Panics if the object is the wrong type.
1502 func (v *Value) EachUint(callback func(int, uint) bool) *Value {
1503
1504         for index, val := range v.MustUintSlice() {
1505                 carryon := callback(index, val)
1506                 if carryon == false {
1507                         break
1508                 }
1509         }
1510
1511         return v
1512
1513 }
1514
1515 // WhereUint uses the specified decider function to select items
1516 // from the []uint.  The object contained in the result will contain
1517 // only the selected items.
1518 func (v *Value) WhereUint(decider func(int, uint) bool) *Value {
1519
1520         var selected []uint
1521
1522         v.EachUint(func(index int, val uint) bool {
1523                 shouldSelect := decider(index, val)
1524                 if shouldSelect == false {
1525                         selected = append(selected, val)
1526                 }
1527                 return true
1528         })
1529
1530         return &Value{data: selected}
1531
1532 }
1533
1534 // GroupUint uses the specified grouper function to group the items
1535 // keyed by the return of the grouper.  The object contained in the
1536 // result will contain a map[string][]uint.
1537 func (v *Value) GroupUint(grouper func(int, uint) string) *Value {
1538
1539         groups := make(map[string][]uint)
1540
1541         v.EachUint(func(index int, val uint) bool {
1542                 group := grouper(index, val)
1543                 if _, ok := groups[group]; !ok {
1544                         groups[group] = make([]uint, 0)
1545                 }
1546                 groups[group] = append(groups[group], val)
1547                 return true
1548         })
1549
1550         return &Value{data: groups}
1551
1552 }
1553
1554 // ReplaceUint uses the specified function to replace each uints
1555 // by iterating each item.  The data in the returned result will be a
1556 // []uint containing the replaced items.
1557 func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value {
1558
1559         arr := v.MustUintSlice()
1560         replaced := make([]uint, len(arr))
1561
1562         v.EachUint(func(index int, val uint) bool {
1563                 replaced[index] = replacer(index, val)
1564                 return true
1565         })
1566
1567         return &Value{data: replaced}
1568
1569 }
1570
1571 // CollectUint uses the specified collector function to collect a value
1572 // for each of the uints in the slice.  The data returned will be a
1573 // []interface{}.
1574 func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value {
1575
1576         arr := v.MustUintSlice()
1577         collected := make([]interface{}, len(arr))
1578
1579         v.EachUint(func(index int, val uint) bool {
1580                 collected[index] = collector(index, val)
1581                 return true
1582         })
1583
1584         return &Value{data: collected}
1585 }
1586
1587 /*
1588         Uint8 (uint8 and []uint8)
1589         --------------------------------------------------
1590 */
1591
1592 // Uint8 gets the value as a uint8, returns the optionalDefault
1593 // value or a system default object if the value is the wrong type.
1594 func (v *Value) Uint8(optionalDefault ...uint8) uint8 {
1595         if s, ok := v.data.(uint8); ok {
1596                 return s
1597         }
1598         if len(optionalDefault) == 1 {
1599                 return optionalDefault[0]
1600         }
1601         return 0
1602 }
1603
1604 // MustUint8 gets the value as a uint8.
1605 //
1606 // Panics if the object is not a uint8.
1607 func (v *Value) MustUint8() uint8 {
1608         return v.data.(uint8)
1609 }
1610
1611 // Uint8Slice gets the value as a []uint8, returns the optionalDefault
1612 // value or nil if the value is not a []uint8.
1613 func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 {
1614         if s, ok := v.data.([]uint8); ok {
1615                 return s
1616         }
1617         if len(optionalDefault) == 1 {
1618                 return optionalDefault[0]
1619         }
1620         return nil
1621 }
1622
1623 // MustUint8Slice gets the value as a []uint8.
1624 //
1625 // Panics if the object is not a []uint8.
1626 func (v *Value) MustUint8Slice() []uint8 {
1627         return v.data.([]uint8)
1628 }
1629
1630 // IsUint8 gets whether the object contained is a uint8 or not.
1631 func (v *Value) IsUint8() bool {
1632         _, ok := v.data.(uint8)
1633         return ok
1634 }
1635
1636 // IsUint8Slice gets whether the object contained is a []uint8 or not.
1637 func (v *Value) IsUint8Slice() bool {
1638         _, ok := v.data.([]uint8)
1639         return ok
1640 }
1641
1642 // EachUint8 calls the specified callback for each object
1643 // in the []uint8.
1644 //
1645 // Panics if the object is the wrong type.
1646 func (v *Value) EachUint8(callback func(int, uint8) bool) *Value {
1647
1648         for index, val := range v.MustUint8Slice() {
1649                 carryon := callback(index, val)
1650                 if carryon == false {
1651                         break
1652                 }
1653         }
1654
1655         return v
1656
1657 }
1658
1659 // WhereUint8 uses the specified decider function to select items
1660 // from the []uint8.  The object contained in the result will contain
1661 // only the selected items.
1662 func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value {
1663
1664         var selected []uint8
1665
1666         v.EachUint8(func(index int, val uint8) bool {
1667                 shouldSelect := decider(index, val)
1668                 if shouldSelect == false {
1669                         selected = append(selected, val)
1670                 }
1671                 return true
1672         })
1673
1674         return &Value{data: selected}
1675
1676 }
1677
1678 // GroupUint8 uses the specified grouper function to group the items
1679 // keyed by the return of the grouper.  The object contained in the
1680 // result will contain a map[string][]uint8.
1681 func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value {
1682
1683         groups := make(map[string][]uint8)
1684
1685         v.EachUint8(func(index int, val uint8) bool {
1686                 group := grouper(index, val)
1687                 if _, ok := groups[group]; !ok {
1688                         groups[group] = make([]uint8, 0)
1689                 }
1690                 groups[group] = append(groups[group], val)
1691                 return true
1692         })
1693
1694         return &Value{data: groups}
1695
1696 }
1697
1698 // ReplaceUint8 uses the specified function to replace each uint8s
1699 // by iterating each item.  The data in the returned result will be a
1700 // []uint8 containing the replaced items.
1701 func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value {
1702
1703         arr := v.MustUint8Slice()
1704         replaced := make([]uint8, len(arr))
1705
1706         v.EachUint8(func(index int, val uint8) bool {
1707                 replaced[index] = replacer(index, val)
1708                 return true
1709         })
1710
1711         return &Value{data: replaced}
1712
1713 }
1714
1715 // CollectUint8 uses the specified collector function to collect a value
1716 // for each of the uint8s in the slice.  The data returned will be a
1717 // []interface{}.
1718 func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value {
1719
1720         arr := v.MustUint8Slice()
1721         collected := make([]interface{}, len(arr))
1722
1723         v.EachUint8(func(index int, val uint8) bool {
1724                 collected[index] = collector(index, val)
1725                 return true
1726         })
1727
1728         return &Value{data: collected}
1729 }
1730
1731 /*
1732         Uint16 (uint16 and []uint16)
1733         --------------------------------------------------
1734 */
1735
1736 // Uint16 gets the value as a uint16, returns the optionalDefault
1737 // value or a system default object if the value is the wrong type.
1738 func (v *Value) Uint16(optionalDefault ...uint16) uint16 {
1739         if s, ok := v.data.(uint16); ok {
1740                 return s
1741         }
1742         if len(optionalDefault) == 1 {
1743                 return optionalDefault[0]
1744         }
1745         return 0
1746 }
1747
1748 // MustUint16 gets the value as a uint16.
1749 //
1750 // Panics if the object is not a uint16.
1751 func (v *Value) MustUint16() uint16 {
1752         return v.data.(uint16)
1753 }
1754
1755 // Uint16Slice gets the value as a []uint16, returns the optionalDefault
1756 // value or nil if the value is not a []uint16.
1757 func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 {
1758         if s, ok := v.data.([]uint16); ok {
1759                 return s
1760         }
1761         if len(optionalDefault) == 1 {
1762                 return optionalDefault[0]
1763         }
1764         return nil
1765 }
1766
1767 // MustUint16Slice gets the value as a []uint16.
1768 //
1769 // Panics if the object is not a []uint16.
1770 func (v *Value) MustUint16Slice() []uint16 {
1771         return v.data.([]uint16)
1772 }
1773
1774 // IsUint16 gets whether the object contained is a uint16 or not.
1775 func (v *Value) IsUint16() bool {
1776         _, ok := v.data.(uint16)
1777         return ok
1778 }
1779
1780 // IsUint16Slice gets whether the object contained is a []uint16 or not.
1781 func (v *Value) IsUint16Slice() bool {
1782         _, ok := v.data.([]uint16)
1783         return ok
1784 }
1785
1786 // EachUint16 calls the specified callback for each object
1787 // in the []uint16.
1788 //
1789 // Panics if the object is the wrong type.
1790 func (v *Value) EachUint16(callback func(int, uint16) bool) *Value {
1791
1792         for index, val := range v.MustUint16Slice() {
1793                 carryon := callback(index, val)
1794                 if carryon == false {
1795                         break
1796                 }
1797         }
1798
1799         return v
1800
1801 }
1802
1803 // WhereUint16 uses the specified decider function to select items
1804 // from the []uint16.  The object contained in the result will contain
1805 // only the selected items.
1806 func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value {
1807
1808         var selected []uint16
1809
1810         v.EachUint16(func(index int, val uint16) bool {
1811                 shouldSelect := decider(index, val)
1812                 if shouldSelect == false {
1813                         selected = append(selected, val)
1814                 }
1815                 return true
1816         })
1817
1818         return &Value{data: selected}
1819
1820 }
1821
1822 // GroupUint16 uses the specified grouper function to group the items
1823 // keyed by the return of the grouper.  The object contained in the
1824 // result will contain a map[string][]uint16.
1825 func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value {
1826
1827         groups := make(map[string][]uint16)
1828
1829         v.EachUint16(func(index int, val uint16) bool {
1830                 group := grouper(index, val)
1831                 if _, ok := groups[group]; !ok {
1832                         groups[group] = make([]uint16, 0)
1833                 }
1834                 groups[group] = append(groups[group], val)
1835                 return true
1836         })
1837
1838         return &Value{data: groups}
1839
1840 }
1841
1842 // ReplaceUint16 uses the specified function to replace each uint16s
1843 // by iterating each item.  The data in the returned result will be a
1844 // []uint16 containing the replaced items.
1845 func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value {
1846
1847         arr := v.MustUint16Slice()
1848         replaced := make([]uint16, len(arr))
1849
1850         v.EachUint16(func(index int, val uint16) bool {
1851                 replaced[index] = replacer(index, val)
1852                 return true
1853         })
1854
1855         return &Value{data: replaced}
1856
1857 }
1858
1859 // CollectUint16 uses the specified collector function to collect a value
1860 // for each of the uint16s in the slice.  The data returned will be a
1861 // []interface{}.
1862 func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value {
1863
1864         arr := v.MustUint16Slice()
1865         collected := make([]interface{}, len(arr))
1866
1867         v.EachUint16(func(index int, val uint16) bool {
1868                 collected[index] = collector(index, val)
1869                 return true
1870         })
1871
1872         return &Value{data: collected}
1873 }
1874
1875 /*
1876         Uint32 (uint32 and []uint32)
1877         --------------------------------------------------
1878 */
1879
1880 // Uint32 gets the value as a uint32, returns the optionalDefault
1881 // value or a system default object if the value is the wrong type.
1882 func (v *Value) Uint32(optionalDefault ...uint32) uint32 {
1883         if s, ok := v.data.(uint32); ok {
1884                 return s
1885         }
1886         if len(optionalDefault) == 1 {
1887                 return optionalDefault[0]
1888         }
1889         return 0
1890 }
1891
1892 // MustUint32 gets the value as a uint32.
1893 //
1894 // Panics if the object is not a uint32.
1895 func (v *Value) MustUint32() uint32 {
1896         return v.data.(uint32)
1897 }
1898
1899 // Uint32Slice gets the value as a []uint32, returns the optionalDefault
1900 // value or nil if the value is not a []uint32.
1901 func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 {
1902         if s, ok := v.data.([]uint32); ok {
1903                 return s
1904         }
1905         if len(optionalDefault) == 1 {
1906                 return optionalDefault[0]
1907         }
1908         return nil
1909 }
1910
1911 // MustUint32Slice gets the value as a []uint32.
1912 //
1913 // Panics if the object is not a []uint32.
1914 func (v *Value) MustUint32Slice() []uint32 {
1915         return v.data.([]uint32)
1916 }
1917
1918 // IsUint32 gets whether the object contained is a uint32 or not.
1919 func (v *Value) IsUint32() bool {
1920         _, ok := v.data.(uint32)
1921         return ok
1922 }
1923
1924 // IsUint32Slice gets whether the object contained is a []uint32 or not.
1925 func (v *Value) IsUint32Slice() bool {
1926         _, ok := v.data.([]uint32)
1927         return ok
1928 }
1929
1930 // EachUint32 calls the specified callback for each object
1931 // in the []uint32.
1932 //
1933 // Panics if the object is the wrong type.
1934 func (v *Value) EachUint32(callback func(int, uint32) bool) *Value {
1935
1936         for index, val := range v.MustUint32Slice() {
1937                 carryon := callback(index, val)
1938                 if carryon == false {
1939                         break
1940                 }
1941         }
1942
1943         return v
1944
1945 }
1946
1947 // WhereUint32 uses the specified decider function to select items
1948 // from the []uint32.  The object contained in the result will contain
1949 // only the selected items.
1950 func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value {
1951
1952         var selected []uint32
1953
1954         v.EachUint32(func(index int, val uint32) bool {
1955                 shouldSelect := decider(index, val)
1956                 if shouldSelect == false {
1957                         selected = append(selected, val)
1958                 }
1959                 return true
1960         })
1961
1962         return &Value{data: selected}
1963
1964 }
1965
1966 // GroupUint32 uses the specified grouper function to group the items
1967 // keyed by the return of the grouper.  The object contained in the
1968 // result will contain a map[string][]uint32.
1969 func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value {
1970
1971         groups := make(map[string][]uint32)
1972
1973         v.EachUint32(func(index int, val uint32) bool {
1974                 group := grouper(index, val)
1975                 if _, ok := groups[group]; !ok {
1976                         groups[group] = make([]uint32, 0)
1977                 }
1978                 groups[group] = append(groups[group], val)
1979                 return true
1980         })
1981
1982         return &Value{data: groups}
1983
1984 }
1985
1986 // ReplaceUint32 uses the specified function to replace each uint32s
1987 // by iterating each item.  The data in the returned result will be a
1988 // []uint32 containing the replaced items.
1989 func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value {
1990
1991         arr := v.MustUint32Slice()
1992         replaced := make([]uint32, len(arr))
1993
1994         v.EachUint32(func(index int, val uint32) bool {
1995                 replaced[index] = replacer(index, val)
1996                 return true
1997         })
1998
1999         return &Value{data: replaced}
2000
2001 }
2002
2003 // CollectUint32 uses the specified collector function to collect a value
2004 // for each of the uint32s in the slice.  The data returned will be a
2005 // []interface{}.
2006 func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value {
2007
2008         arr := v.MustUint32Slice()
2009         collected := make([]interface{}, len(arr))
2010
2011         v.EachUint32(func(index int, val uint32) bool {
2012                 collected[index] = collector(index, val)
2013                 return true
2014         })
2015
2016         return &Value{data: collected}
2017 }
2018
2019 /*
2020         Uint64 (uint64 and []uint64)
2021         --------------------------------------------------
2022 */
2023
2024 // Uint64 gets the value as a uint64, returns the optionalDefault
2025 // value or a system default object if the value is the wrong type.
2026 func (v *Value) Uint64(optionalDefault ...uint64) uint64 {
2027         if s, ok := v.data.(uint64); ok {
2028                 return s
2029         }
2030         if len(optionalDefault) == 1 {
2031                 return optionalDefault[0]
2032         }
2033         return 0
2034 }
2035
2036 // MustUint64 gets the value as a uint64.
2037 //
2038 // Panics if the object is not a uint64.
2039 func (v *Value) MustUint64() uint64 {
2040         return v.data.(uint64)
2041 }
2042
2043 // Uint64Slice gets the value as a []uint64, returns the optionalDefault
2044 // value or nil if the value is not a []uint64.
2045 func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 {
2046         if s, ok := v.data.([]uint64); ok {
2047                 return s
2048         }
2049         if len(optionalDefault) == 1 {
2050                 return optionalDefault[0]
2051         }
2052         return nil
2053 }
2054
2055 // MustUint64Slice gets the value as a []uint64.
2056 //
2057 // Panics if the object is not a []uint64.
2058 func (v *Value) MustUint64Slice() []uint64 {
2059         return v.data.([]uint64)
2060 }
2061
2062 // IsUint64 gets whether the object contained is a uint64 or not.
2063 func (v *Value) IsUint64() bool {
2064         _, ok := v.data.(uint64)
2065         return ok
2066 }
2067
2068 // IsUint64Slice gets whether the object contained is a []uint64 or not.
2069 func (v *Value) IsUint64Slice() bool {
2070         _, ok := v.data.([]uint64)
2071         return ok
2072 }
2073
2074 // EachUint64 calls the specified callback for each object
2075 // in the []uint64.
2076 //
2077 // Panics if the object is the wrong type.
2078 func (v *Value) EachUint64(callback func(int, uint64) bool) *Value {
2079
2080         for index, val := range v.MustUint64Slice() {
2081                 carryon := callback(index, val)
2082                 if carryon == false {
2083                         break
2084                 }
2085         }
2086
2087         return v
2088
2089 }
2090
2091 // WhereUint64 uses the specified decider function to select items
2092 // from the []uint64.  The object contained in the result will contain
2093 // only the selected items.
2094 func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value {
2095
2096         var selected []uint64
2097
2098         v.EachUint64(func(index int, val uint64) bool {
2099                 shouldSelect := decider(index, val)
2100                 if shouldSelect == false {
2101                         selected = append(selected, val)
2102                 }
2103                 return true
2104         })
2105
2106         return &Value{data: selected}
2107
2108 }
2109
2110 // GroupUint64 uses the specified grouper function to group the items
2111 // keyed by the return of the grouper.  The object contained in the
2112 // result will contain a map[string][]uint64.
2113 func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value {
2114
2115         groups := make(map[string][]uint64)
2116
2117         v.EachUint64(func(index int, val uint64) bool {
2118                 group := grouper(index, val)
2119                 if _, ok := groups[group]; !ok {
2120                         groups[group] = make([]uint64, 0)
2121                 }
2122                 groups[group] = append(groups[group], val)
2123                 return true
2124         })
2125
2126         return &Value{data: groups}
2127
2128 }
2129
2130 // ReplaceUint64 uses the specified function to replace each uint64s
2131 // by iterating each item.  The data in the returned result will be a
2132 // []uint64 containing the replaced items.
2133 func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value {
2134
2135         arr := v.MustUint64Slice()
2136         replaced := make([]uint64, len(arr))
2137
2138         v.EachUint64(func(index int, val uint64) bool {
2139                 replaced[index] = replacer(index, val)
2140                 return true
2141         })
2142
2143         return &Value{data: replaced}
2144
2145 }
2146
2147 // CollectUint64 uses the specified collector function to collect a value
2148 // for each of the uint64s in the slice.  The data returned will be a
2149 // []interface{}.
2150 func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value {
2151
2152         arr := v.MustUint64Slice()
2153         collected := make([]interface{}, len(arr))
2154
2155         v.EachUint64(func(index int, val uint64) bool {
2156                 collected[index] = collector(index, val)
2157                 return true
2158         })
2159
2160         return &Value{data: collected}
2161 }
2162
2163 /*
2164         Uintptr (uintptr and []uintptr)
2165         --------------------------------------------------
2166 */
2167
2168 // Uintptr gets the value as a uintptr, returns the optionalDefault
2169 // value or a system default object if the value is the wrong type.
2170 func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr {
2171         if s, ok := v.data.(uintptr); ok {
2172                 return s
2173         }
2174         if len(optionalDefault) == 1 {
2175                 return optionalDefault[0]
2176         }
2177         return 0
2178 }
2179
2180 // MustUintptr gets the value as a uintptr.
2181 //
2182 // Panics if the object is not a uintptr.
2183 func (v *Value) MustUintptr() uintptr {
2184         return v.data.(uintptr)
2185 }
2186
2187 // UintptrSlice gets the value as a []uintptr, returns the optionalDefault
2188 // value or nil if the value is not a []uintptr.
2189 func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr {
2190         if s, ok := v.data.([]uintptr); ok {
2191                 return s
2192         }
2193         if len(optionalDefault) == 1 {
2194                 return optionalDefault[0]
2195         }
2196         return nil
2197 }
2198
2199 // MustUintptrSlice gets the value as a []uintptr.
2200 //
2201 // Panics if the object is not a []uintptr.
2202 func (v *Value) MustUintptrSlice() []uintptr {
2203         return v.data.([]uintptr)
2204 }
2205
2206 // IsUintptr gets whether the object contained is a uintptr or not.
2207 func (v *Value) IsUintptr() bool {
2208         _, ok := v.data.(uintptr)
2209         return ok
2210 }
2211
2212 // IsUintptrSlice gets whether the object contained is a []uintptr or not.
2213 func (v *Value) IsUintptrSlice() bool {
2214         _, ok := v.data.([]uintptr)
2215         return ok
2216 }
2217
2218 // EachUintptr calls the specified callback for each object
2219 // in the []uintptr.
2220 //
2221 // Panics if the object is the wrong type.
2222 func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value {
2223
2224         for index, val := range v.MustUintptrSlice() {
2225                 carryon := callback(index, val)
2226                 if carryon == false {
2227                         break
2228                 }
2229         }
2230
2231         return v
2232
2233 }
2234
2235 // WhereUintptr uses the specified decider function to select items
2236 // from the []uintptr.  The object contained in the result will contain
2237 // only the selected items.
2238 func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value {
2239
2240         var selected []uintptr
2241
2242         v.EachUintptr(func(index int, val uintptr) bool {
2243                 shouldSelect := decider(index, val)
2244                 if shouldSelect == false {
2245                         selected = append(selected, val)
2246                 }
2247                 return true
2248         })
2249
2250         return &Value{data: selected}
2251
2252 }
2253
2254 // GroupUintptr uses the specified grouper function to group the items
2255 // keyed by the return of the grouper.  The object contained in the
2256 // result will contain a map[string][]uintptr.
2257 func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value {
2258
2259         groups := make(map[string][]uintptr)
2260
2261         v.EachUintptr(func(index int, val uintptr) bool {
2262                 group := grouper(index, val)
2263                 if _, ok := groups[group]; !ok {
2264                         groups[group] = make([]uintptr, 0)
2265                 }
2266                 groups[group] = append(groups[group], val)
2267                 return true
2268         })
2269
2270         return &Value{data: groups}
2271
2272 }
2273
2274 // ReplaceUintptr uses the specified function to replace each uintptrs
2275 // by iterating each item.  The data in the returned result will be a
2276 // []uintptr containing the replaced items.
2277 func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value {
2278
2279         arr := v.MustUintptrSlice()
2280         replaced := make([]uintptr, len(arr))
2281
2282         v.EachUintptr(func(index int, val uintptr) bool {
2283                 replaced[index] = replacer(index, val)
2284                 return true
2285         })
2286
2287         return &Value{data: replaced}
2288
2289 }
2290
2291 // CollectUintptr uses the specified collector function to collect a value
2292 // for each of the uintptrs in the slice.  The data returned will be a
2293 // []interface{}.
2294 func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value {
2295
2296         arr := v.MustUintptrSlice()
2297         collected := make([]interface{}, len(arr))
2298
2299         v.EachUintptr(func(index int, val uintptr) bool {
2300                 collected[index] = collector(index, val)
2301                 return true
2302         })
2303
2304         return &Value{data: collected}
2305 }
2306
2307 /*
2308         Float32 (float32 and []float32)
2309         --------------------------------------------------
2310 */
2311
2312 // Float32 gets the value as a float32, returns the optionalDefault
2313 // value or a system default object if the value is the wrong type.
2314 func (v *Value) Float32(optionalDefault ...float32) float32 {
2315         if s, ok := v.data.(float32); ok {
2316                 return s
2317         }
2318         if len(optionalDefault) == 1 {
2319                 return optionalDefault[0]
2320         }
2321         return 0
2322 }
2323
2324 // MustFloat32 gets the value as a float32.
2325 //
2326 // Panics if the object is not a float32.
2327 func (v *Value) MustFloat32() float32 {
2328         return v.data.(float32)
2329 }
2330
2331 // Float32Slice gets the value as a []float32, returns the optionalDefault
2332 // value or nil if the value is not a []float32.
2333 func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 {
2334         if s, ok := v.data.([]float32); ok {
2335                 return s
2336         }
2337         if len(optionalDefault) == 1 {
2338                 return optionalDefault[0]
2339         }
2340         return nil
2341 }
2342
2343 // MustFloat32Slice gets the value as a []float32.
2344 //
2345 // Panics if the object is not a []float32.
2346 func (v *Value) MustFloat32Slice() []float32 {
2347         return v.data.([]float32)
2348 }
2349
2350 // IsFloat32 gets whether the object contained is a float32 or not.
2351 func (v *Value) IsFloat32() bool {
2352         _, ok := v.data.(float32)
2353         return ok
2354 }
2355
2356 // IsFloat32Slice gets whether the object contained is a []float32 or not.
2357 func (v *Value) IsFloat32Slice() bool {
2358         _, ok := v.data.([]float32)
2359         return ok
2360 }
2361
2362 // EachFloat32 calls the specified callback for each object
2363 // in the []float32.
2364 //
2365 // Panics if the object is the wrong type.
2366 func (v *Value) EachFloat32(callback func(int, float32) bool) *Value {
2367
2368         for index, val := range v.MustFloat32Slice() {
2369                 carryon := callback(index, val)
2370                 if carryon == false {
2371                         break
2372                 }
2373         }
2374
2375         return v
2376
2377 }
2378
2379 // WhereFloat32 uses the specified decider function to select items
2380 // from the []float32.  The object contained in the result will contain
2381 // only the selected items.
2382 func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value {
2383
2384         var selected []float32
2385
2386         v.EachFloat32(func(index int, val float32) bool {
2387                 shouldSelect := decider(index, val)
2388                 if shouldSelect == false {
2389                         selected = append(selected, val)
2390                 }
2391                 return true
2392         })
2393
2394         return &Value{data: selected}
2395
2396 }
2397
2398 // GroupFloat32 uses the specified grouper function to group the items
2399 // keyed by the return of the grouper.  The object contained in the
2400 // result will contain a map[string][]float32.
2401 func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value {
2402
2403         groups := make(map[string][]float32)
2404
2405         v.EachFloat32(func(index int, val float32) bool {
2406                 group := grouper(index, val)
2407                 if _, ok := groups[group]; !ok {
2408                         groups[group] = make([]float32, 0)
2409                 }
2410                 groups[group] = append(groups[group], val)
2411                 return true
2412         })
2413
2414         return &Value{data: groups}
2415
2416 }
2417
2418 // ReplaceFloat32 uses the specified function to replace each float32s
2419 // by iterating each item.  The data in the returned result will be a
2420 // []float32 containing the replaced items.
2421 func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value {
2422
2423         arr := v.MustFloat32Slice()
2424         replaced := make([]float32, len(arr))
2425
2426         v.EachFloat32(func(index int, val float32) bool {
2427                 replaced[index] = replacer(index, val)
2428                 return true
2429         })
2430
2431         return &Value{data: replaced}
2432
2433 }
2434
2435 // CollectFloat32 uses the specified collector function to collect a value
2436 // for each of the float32s in the slice.  The data returned will be a
2437 // []interface{}.
2438 func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value {
2439
2440         arr := v.MustFloat32Slice()
2441         collected := make([]interface{}, len(arr))
2442
2443         v.EachFloat32(func(index int, val float32) bool {
2444                 collected[index] = collector(index, val)
2445                 return true
2446         })
2447
2448         return &Value{data: collected}
2449 }
2450
2451 /*
2452         Float64 (float64 and []float64)
2453         --------------------------------------------------
2454 */
2455
2456 // Float64 gets the value as a float64, returns the optionalDefault
2457 // value or a system default object if the value is the wrong type.
2458 func (v *Value) Float64(optionalDefault ...float64) float64 {
2459         if s, ok := v.data.(float64); ok {
2460                 return s
2461         }
2462         if len(optionalDefault) == 1 {
2463                 return optionalDefault[0]
2464         }
2465         return 0
2466 }
2467
2468 // MustFloat64 gets the value as a float64.
2469 //
2470 // Panics if the object is not a float64.
2471 func (v *Value) MustFloat64() float64 {
2472         return v.data.(float64)
2473 }
2474
2475 // Float64Slice gets the value as a []float64, returns the optionalDefault
2476 // value or nil if the value is not a []float64.
2477 func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 {
2478         if s, ok := v.data.([]float64); ok {
2479                 return s
2480         }
2481         if len(optionalDefault) == 1 {
2482                 return optionalDefault[0]
2483         }
2484         return nil
2485 }
2486
2487 // MustFloat64Slice gets the value as a []float64.
2488 //
2489 // Panics if the object is not a []float64.
2490 func (v *Value) MustFloat64Slice() []float64 {
2491         return v.data.([]float64)
2492 }
2493
2494 // IsFloat64 gets whether the object contained is a float64 or not.
2495 func (v *Value) IsFloat64() bool {
2496         _, ok := v.data.(float64)
2497         return ok
2498 }
2499
2500 // IsFloat64Slice gets whether the object contained is a []float64 or not.
2501 func (v *Value) IsFloat64Slice() bool {
2502         _, ok := v.data.([]float64)
2503         return ok
2504 }
2505
2506 // EachFloat64 calls the specified callback for each object
2507 // in the []float64.
2508 //
2509 // Panics if the object is the wrong type.
2510 func (v *Value) EachFloat64(callback func(int, float64) bool) *Value {
2511
2512         for index, val := range v.MustFloat64Slice() {
2513                 carryon := callback(index, val)
2514                 if carryon == false {
2515                         break
2516                 }
2517         }
2518
2519         return v
2520
2521 }
2522
2523 // WhereFloat64 uses the specified decider function to select items
2524 // from the []float64.  The object contained in the result will contain
2525 // only the selected items.
2526 func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value {
2527
2528         var selected []float64
2529
2530         v.EachFloat64(func(index int, val float64) bool {
2531                 shouldSelect := decider(index, val)
2532                 if shouldSelect == false {
2533                         selected = append(selected, val)
2534                 }
2535                 return true
2536         })
2537
2538         return &Value{data: selected}
2539
2540 }
2541
2542 // GroupFloat64 uses the specified grouper function to group the items
2543 // keyed by the return of the grouper.  The object contained in the
2544 // result will contain a map[string][]float64.
2545 func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value {
2546
2547         groups := make(map[string][]float64)
2548
2549         v.EachFloat64(func(index int, val float64) bool {
2550                 group := grouper(index, val)
2551                 if _, ok := groups[group]; !ok {
2552                         groups[group] = make([]float64, 0)
2553                 }
2554                 groups[group] = append(groups[group], val)
2555                 return true
2556         })
2557
2558         return &Value{data: groups}
2559
2560 }
2561
2562 // ReplaceFloat64 uses the specified function to replace each float64s
2563 // by iterating each item.  The data in the returned result will be a
2564 // []float64 containing the replaced items.
2565 func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value {
2566
2567         arr := v.MustFloat64Slice()
2568         replaced := make([]float64, len(arr))
2569
2570         v.EachFloat64(func(index int, val float64) bool {
2571                 replaced[index] = replacer(index, val)
2572                 return true
2573         })
2574
2575         return &Value{data: replaced}
2576
2577 }
2578
2579 // CollectFloat64 uses the specified collector function to collect a value
2580 // for each of the float64s in the slice.  The data returned will be a
2581 // []interface{}.
2582 func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value {
2583
2584         arr := v.MustFloat64Slice()
2585         collected := make([]interface{}, len(arr))
2586
2587         v.EachFloat64(func(index int, val float64) bool {
2588                 collected[index] = collector(index, val)
2589                 return true
2590         })
2591
2592         return &Value{data: collected}
2593 }
2594
2595 /*
2596         Complex64 (complex64 and []complex64)
2597         --------------------------------------------------
2598 */
2599
2600 // Complex64 gets the value as a complex64, returns the optionalDefault
2601 // value or a system default object if the value is the wrong type.
2602 func (v *Value) Complex64(optionalDefault ...complex64) complex64 {
2603         if s, ok := v.data.(complex64); ok {
2604                 return s
2605         }
2606         if len(optionalDefault) == 1 {
2607                 return optionalDefault[0]
2608         }
2609         return 0
2610 }
2611
2612 // MustComplex64 gets the value as a complex64.
2613 //
2614 // Panics if the object is not a complex64.
2615 func (v *Value) MustComplex64() complex64 {
2616         return v.data.(complex64)
2617 }
2618
2619 // Complex64Slice gets the value as a []complex64, returns the optionalDefault
2620 // value or nil if the value is not a []complex64.
2621 func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 {
2622         if s, ok := v.data.([]complex64); ok {
2623                 return s
2624         }
2625         if len(optionalDefault) == 1 {
2626                 return optionalDefault[0]
2627         }
2628         return nil
2629 }
2630
2631 // MustComplex64Slice gets the value as a []complex64.
2632 //
2633 // Panics if the object is not a []complex64.
2634 func (v *Value) MustComplex64Slice() []complex64 {
2635         return v.data.([]complex64)
2636 }
2637
2638 // IsComplex64 gets whether the object contained is a complex64 or not.
2639 func (v *Value) IsComplex64() bool {
2640         _, ok := v.data.(complex64)
2641         return ok
2642 }
2643
2644 // IsComplex64Slice gets whether the object contained is a []complex64 or not.
2645 func (v *Value) IsComplex64Slice() bool {
2646         _, ok := v.data.([]complex64)
2647         return ok
2648 }
2649
2650 // EachComplex64 calls the specified callback for each object
2651 // in the []complex64.
2652 //
2653 // Panics if the object is the wrong type.
2654 func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value {
2655
2656         for index, val := range v.MustComplex64Slice() {
2657                 carryon := callback(index, val)
2658                 if carryon == false {
2659                         break
2660                 }
2661         }
2662
2663         return v
2664
2665 }
2666
2667 // WhereComplex64 uses the specified decider function to select items
2668 // from the []complex64.  The object contained in the result will contain
2669 // only the selected items.
2670 func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value {
2671
2672         var selected []complex64
2673
2674         v.EachComplex64(func(index int, val complex64) bool {
2675                 shouldSelect := decider(index, val)
2676                 if shouldSelect == false {
2677                         selected = append(selected, val)
2678                 }
2679                 return true
2680         })
2681
2682         return &Value{data: selected}
2683
2684 }
2685
2686 // GroupComplex64 uses the specified grouper function to group the items
2687 // keyed by the return of the grouper.  The object contained in the
2688 // result will contain a map[string][]complex64.
2689 func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value {
2690
2691         groups := make(map[string][]complex64)
2692
2693         v.EachComplex64(func(index int, val complex64) bool {
2694                 group := grouper(index, val)
2695                 if _, ok := groups[group]; !ok {
2696                         groups[group] = make([]complex64, 0)
2697                 }
2698                 groups[group] = append(groups[group], val)
2699                 return true
2700         })
2701
2702         return &Value{data: groups}
2703
2704 }
2705
2706 // ReplaceComplex64 uses the specified function to replace each complex64s
2707 // by iterating each item.  The data in the returned result will be a
2708 // []complex64 containing the replaced items.
2709 func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value {
2710
2711         arr := v.MustComplex64Slice()
2712         replaced := make([]complex64, len(arr))
2713
2714         v.EachComplex64(func(index int, val complex64) bool {
2715                 replaced[index] = replacer(index, val)
2716                 return true
2717         })
2718
2719         return &Value{data: replaced}
2720
2721 }
2722
2723 // CollectComplex64 uses the specified collector function to collect a value
2724 // for each of the complex64s in the slice.  The data returned will be a
2725 // []interface{}.
2726 func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value {
2727
2728         arr := v.MustComplex64Slice()
2729         collected := make([]interface{}, len(arr))
2730
2731         v.EachComplex64(func(index int, val complex64) bool {
2732                 collected[index] = collector(index, val)
2733                 return true
2734         })
2735
2736         return &Value{data: collected}
2737 }
2738
2739 /*
2740         Complex128 (complex128 and []complex128)
2741         --------------------------------------------------
2742 */
2743
2744 // Complex128 gets the value as a complex128, returns the optionalDefault
2745 // value or a system default object if the value is the wrong type.
2746 func (v *Value) Complex128(optionalDefault ...complex128) complex128 {
2747         if s, ok := v.data.(complex128); ok {
2748                 return s
2749         }
2750         if len(optionalDefault) == 1 {
2751                 return optionalDefault[0]
2752         }
2753         return 0
2754 }
2755
2756 // MustComplex128 gets the value as a complex128.
2757 //
2758 // Panics if the object is not a complex128.
2759 func (v *Value) MustComplex128() complex128 {
2760         return v.data.(complex128)
2761 }
2762
2763 // Complex128Slice gets the value as a []complex128, returns the optionalDefault
2764 // value or nil if the value is not a []complex128.
2765 func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 {
2766         if s, ok := v.data.([]complex128); ok {
2767                 return s
2768         }
2769         if len(optionalDefault) == 1 {
2770                 return optionalDefault[0]
2771         }
2772         return nil
2773 }
2774
2775 // MustComplex128Slice gets the value as a []complex128.
2776 //
2777 // Panics if the object is not a []complex128.
2778 func (v *Value) MustComplex128Slice() []complex128 {
2779         return v.data.([]complex128)
2780 }
2781
2782 // IsComplex128 gets whether the object contained is a complex128 or not.
2783 func (v *Value) IsComplex128() bool {
2784         _, ok := v.data.(complex128)
2785         return ok
2786 }
2787
2788 // IsComplex128Slice gets whether the object contained is a []complex128 or not.
2789 func (v *Value) IsComplex128Slice() bool {
2790         _, ok := v.data.([]complex128)
2791         return ok
2792 }
2793
2794 // EachComplex128 calls the specified callback for each object
2795 // in the []complex128.
2796 //
2797 // Panics if the object is the wrong type.
2798 func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value {
2799
2800         for index, val := range v.MustComplex128Slice() {
2801                 carryon := callback(index, val)
2802                 if carryon == false {
2803                         break
2804                 }
2805         }
2806
2807         return v
2808
2809 }
2810
2811 // WhereComplex128 uses the specified decider function to select items
2812 // from the []complex128.  The object contained in the result will contain
2813 // only the selected items.
2814 func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value {
2815
2816         var selected []complex128
2817
2818         v.EachComplex128(func(index int, val complex128) bool {
2819                 shouldSelect := decider(index, val)
2820                 if shouldSelect == false {
2821                         selected = append(selected, val)
2822                 }
2823                 return true
2824         })
2825
2826         return &Value{data: selected}
2827
2828 }
2829
2830 // GroupComplex128 uses the specified grouper function to group the items
2831 // keyed by the return of the grouper.  The object contained in the
2832 // result will contain a map[string][]complex128.
2833 func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value {
2834
2835         groups := make(map[string][]complex128)
2836
2837         v.EachComplex128(func(index int, val complex128) bool {
2838                 group := grouper(index, val)
2839                 if _, ok := groups[group]; !ok {
2840                         groups[group] = make([]complex128, 0)
2841                 }
2842                 groups[group] = append(groups[group], val)
2843                 return true
2844         })
2845
2846         return &Value{data: groups}
2847
2848 }
2849
2850 // ReplaceComplex128 uses the specified function to replace each complex128s
2851 // by iterating each item.  The data in the returned result will be a
2852 // []complex128 containing the replaced items.
2853 func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value {
2854
2855         arr := v.MustComplex128Slice()
2856         replaced := make([]complex128, len(arr))
2857
2858         v.EachComplex128(func(index int, val complex128) bool {
2859                 replaced[index] = replacer(index, val)
2860                 return true
2861         })
2862
2863         return &Value{data: replaced}
2864
2865 }
2866
2867 // CollectComplex128 uses the specified collector function to collect a value
2868 // for each of the complex128s in the slice.  The data returned will be a
2869 // []interface{}.
2870 func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value {
2871
2872         arr := v.MustComplex128Slice()
2873         collected := make([]interface{}, len(arr))
2874
2875         v.EachComplex128(func(index int, val complex128) bool {
2876                 collected[index] = collector(index, val)
2877                 return true
2878         })
2879
2880         return &Value{data: collected}
2881 }