gopkg.in/alecthomas/gometalinter.v3@v3.0.0/_linters/src/github.com/stretchr/objx/type_specific_codegen.go (about)

     1  package objx
     2  
     3  /*
     4     Inter (interface{} and []interface{})
     5  */
     6  
     7  // Inter gets the value as a interface{}, returns the optionalDefault
     8  // value or a system default object if the value is the wrong type.
     9  func (v *Value) Inter(optionalDefault ...interface{}) interface{} {
    10  	if s, ok := v.data.(interface{}); ok {
    11  		return s
    12  	}
    13  	if len(optionalDefault) == 1 {
    14  		return optionalDefault[0]
    15  	}
    16  	return nil
    17  }
    18  
    19  // MustInter gets the value as a interface{}.
    20  //
    21  // Panics if the object is not a interface{}.
    22  func (v *Value) MustInter() interface{} {
    23  	return v.data.(interface{})
    24  }
    25  
    26  // InterSlice gets the value as a []interface{}, returns the optionalDefault
    27  // value or nil if the value is not a []interface{}.
    28  func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} {
    29  	if s, ok := v.data.([]interface{}); ok {
    30  		return s
    31  	}
    32  	if len(optionalDefault) == 1 {
    33  		return optionalDefault[0]
    34  	}
    35  	return nil
    36  }
    37  
    38  // MustInterSlice gets the value as a []interface{}.
    39  //
    40  // Panics if the object is not a []interface{}.
    41  func (v *Value) MustInterSlice() []interface{} {
    42  	return v.data.([]interface{})
    43  }
    44  
    45  // IsInter gets whether the object contained is a interface{} or not.
    46  func (v *Value) IsInter() bool {
    47  	_, ok := v.data.(interface{})
    48  	return ok
    49  }
    50  
    51  // IsInterSlice gets whether the object contained is a []interface{} or not.
    52  func (v *Value) IsInterSlice() bool {
    53  	_, ok := v.data.([]interface{})
    54  	return ok
    55  }
    56  
    57  // EachInter calls the specified callback for each object
    58  // in the []interface{}.
    59  //
    60  // Panics if the object is the wrong type.
    61  func (v *Value) EachInter(callback func(int, interface{}) bool) *Value {
    62  	for index, val := range v.MustInterSlice() {
    63  		carryon := callback(index, val)
    64  		if !carryon {
    65  			break
    66  		}
    67  	}
    68  	return v
    69  }
    70  
    71  // WhereInter uses the specified decider function to select items
    72  // from the []interface{}.  The object contained in the result will contain
    73  // only the selected items.
    74  func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value {
    75  	var selected []interface{}
    76  	v.EachInter(func(index int, val interface{}) bool {
    77  		shouldSelect := decider(index, val)
    78  		if !shouldSelect {
    79  			selected = append(selected, val)
    80  		}
    81  		return true
    82  	})
    83  	return &Value{data: selected}
    84  }
    85  
    86  // GroupInter uses the specified grouper function to group the items
    87  // keyed by the return of the grouper.  The object contained in the
    88  // result will contain a map[string][]interface{}.
    89  func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value {
    90  	groups := make(map[string][]interface{})
    91  	v.EachInter(func(index int, val interface{}) bool {
    92  		group := grouper(index, val)
    93  		if _, ok := groups[group]; !ok {
    94  			groups[group] = make([]interface{}, 0)
    95  		}
    96  		groups[group] = append(groups[group], val)
    97  		return true
    98  	})
    99  	return &Value{data: groups}
   100  }
   101  
   102  // ReplaceInter uses the specified function to replace each interface{}s
   103  // by iterating each item.  The data in the returned result will be a
   104  // []interface{} containing the replaced items.
   105  func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value {
   106  	arr := v.MustInterSlice()
   107  	replaced := make([]interface{}, len(arr))
   108  	v.EachInter(func(index int, val interface{}) bool {
   109  		replaced[index] = replacer(index, val)
   110  		return true
   111  	})
   112  	return &Value{data: replaced}
   113  }
   114  
   115  // CollectInter uses the specified collector function to collect a value
   116  // for each of the interface{}s in the slice.  The data returned will be a
   117  // []interface{}.
   118  func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value {
   119  	arr := v.MustInterSlice()
   120  	collected := make([]interface{}, len(arr))
   121  	v.EachInter(func(index int, val interface{}) bool {
   122  		collected[index] = collector(index, val)
   123  		return true
   124  	})
   125  	return &Value{data: collected}
   126  }
   127  
   128  /*
   129     Bool (bool and []bool)
   130  */
   131  
   132  // Bool gets the value as a bool, returns the optionalDefault
   133  // value or a system default object if the value is the wrong type.
   134  func (v *Value) Bool(optionalDefault ...bool) bool {
   135  	if s, ok := v.data.(bool); ok {
   136  		return s
   137  	}
   138  	if len(optionalDefault) == 1 {
   139  		return optionalDefault[0]
   140  	}
   141  	return false
   142  }
   143  
   144  // MustBool gets the value as a bool.
   145  //
   146  // Panics if the object is not a bool.
   147  func (v *Value) MustBool() bool {
   148  	return v.data.(bool)
   149  }
   150  
   151  // BoolSlice gets the value as a []bool, returns the optionalDefault
   152  // value or nil if the value is not a []bool.
   153  func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool {
   154  	if s, ok := v.data.([]bool); ok {
   155  		return s
   156  	}
   157  	if len(optionalDefault) == 1 {
   158  		return optionalDefault[0]
   159  	}
   160  	return nil
   161  }
   162  
   163  // MustBoolSlice gets the value as a []bool.
   164  //
   165  // Panics if the object is not a []bool.
   166  func (v *Value) MustBoolSlice() []bool {
   167  	return v.data.([]bool)
   168  }
   169  
   170  // IsBool gets whether the object contained is a bool or not.
   171  func (v *Value) IsBool() bool {
   172  	_, ok := v.data.(bool)
   173  	return ok
   174  }
   175  
   176  // IsBoolSlice gets whether the object contained is a []bool or not.
   177  func (v *Value) IsBoolSlice() bool {
   178  	_, ok := v.data.([]bool)
   179  	return ok
   180  }
   181  
   182  // EachBool calls the specified callback for each object
   183  // in the []bool.
   184  //
   185  // Panics if the object is the wrong type.
   186  func (v *Value) EachBool(callback func(int, bool) bool) *Value {
   187  	for index, val := range v.MustBoolSlice() {
   188  		carryon := callback(index, val)
   189  		if !carryon {
   190  			break
   191  		}
   192  	}
   193  	return v
   194  }
   195  
   196  // WhereBool uses the specified decider function to select items
   197  // from the []bool.  The object contained in the result will contain
   198  // only the selected items.
   199  func (v *Value) WhereBool(decider func(int, bool) bool) *Value {
   200  	var selected []bool
   201  	v.EachBool(func(index int, val bool) bool {
   202  		shouldSelect := decider(index, val)
   203  		if !shouldSelect {
   204  			selected = append(selected, val)
   205  		}
   206  		return true
   207  	})
   208  	return &Value{data: selected}
   209  }
   210  
   211  // GroupBool uses the specified grouper function to group the items
   212  // keyed by the return of the grouper.  The object contained in the
   213  // result will contain a map[string][]bool.
   214  func (v *Value) GroupBool(grouper func(int, bool) string) *Value {
   215  	groups := make(map[string][]bool)
   216  	v.EachBool(func(index int, val bool) bool {
   217  		group := grouper(index, val)
   218  		if _, ok := groups[group]; !ok {
   219  			groups[group] = make([]bool, 0)
   220  		}
   221  		groups[group] = append(groups[group], val)
   222  		return true
   223  	})
   224  	return &Value{data: groups}
   225  }
   226  
   227  // ReplaceBool uses the specified function to replace each bools
   228  // by iterating each item.  The data in the returned result will be a
   229  // []bool containing the replaced items.
   230  func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value {
   231  	arr := v.MustBoolSlice()
   232  	replaced := make([]bool, len(arr))
   233  	v.EachBool(func(index int, val bool) bool {
   234  		replaced[index] = replacer(index, val)
   235  		return true
   236  	})
   237  	return &Value{data: replaced}
   238  }
   239  
   240  // CollectBool uses the specified collector function to collect a value
   241  // for each of the bools in the slice.  The data returned will be a
   242  // []interface{}.
   243  func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value {
   244  	arr := v.MustBoolSlice()
   245  	collected := make([]interface{}, len(arr))
   246  	v.EachBool(func(index int, val bool) bool {
   247  		collected[index] = collector(index, val)
   248  		return true
   249  	})
   250  	return &Value{data: collected}
   251  }
   252  
   253  /*
   254     Str (string and []string)
   255  */
   256  
   257  // Str gets the value as a string, returns the optionalDefault
   258  // value or a system default object if the value is the wrong type.
   259  func (v *Value) Str(optionalDefault ...string) string {
   260  	if s, ok := v.data.(string); ok {
   261  		return s
   262  	}
   263  	if len(optionalDefault) == 1 {
   264  		return optionalDefault[0]
   265  	}
   266  	return ""
   267  }
   268  
   269  // MustStr gets the value as a string.
   270  //
   271  // Panics if the object is not a string.
   272  func (v *Value) MustStr() string {
   273  	return v.data.(string)
   274  }
   275  
   276  // StrSlice gets the value as a []string, returns the optionalDefault
   277  // value or nil if the value is not a []string.
   278  func (v *Value) StrSlice(optionalDefault ...[]string) []string {
   279  	if s, ok := v.data.([]string); ok {
   280  		return s
   281  	}
   282  	if len(optionalDefault) == 1 {
   283  		return optionalDefault[0]
   284  	}
   285  	return nil
   286  }
   287  
   288  // MustStrSlice gets the value as a []string.
   289  //
   290  // Panics if the object is not a []string.
   291  func (v *Value) MustStrSlice() []string {
   292  	return v.data.([]string)
   293  }
   294  
   295  // IsStr gets whether the object contained is a string or not.
   296  func (v *Value) IsStr() bool {
   297  	_, ok := v.data.(string)
   298  	return ok
   299  }
   300  
   301  // IsStrSlice gets whether the object contained is a []string or not.
   302  func (v *Value) IsStrSlice() bool {
   303  	_, ok := v.data.([]string)
   304  	return ok
   305  }
   306  
   307  // EachStr calls the specified callback for each object
   308  // in the []string.
   309  //
   310  // Panics if the object is the wrong type.
   311  func (v *Value) EachStr(callback func(int, string) bool) *Value {
   312  	for index, val := range v.MustStrSlice() {
   313  		carryon := callback(index, val)
   314  		if !carryon {
   315  			break
   316  		}
   317  	}
   318  	return v
   319  }
   320  
   321  // WhereStr uses the specified decider function to select items
   322  // from the []string.  The object contained in the result will contain
   323  // only the selected items.
   324  func (v *Value) WhereStr(decider func(int, string) bool) *Value {
   325  	var selected []string
   326  	v.EachStr(func(index int, val string) bool {
   327  		shouldSelect := decider(index, val)
   328  		if !shouldSelect {
   329  			selected = append(selected, val)
   330  		}
   331  		return true
   332  	})
   333  	return &Value{data: selected}
   334  }
   335  
   336  // GroupStr uses the specified grouper function to group the items
   337  // keyed by the return of the grouper.  The object contained in the
   338  // result will contain a map[string][]string.
   339  func (v *Value) GroupStr(grouper func(int, string) string) *Value {
   340  	groups := make(map[string][]string)
   341  	v.EachStr(func(index int, val string) bool {
   342  		group := grouper(index, val)
   343  		if _, ok := groups[group]; !ok {
   344  			groups[group] = make([]string, 0)
   345  		}
   346  		groups[group] = append(groups[group], val)
   347  		return true
   348  	})
   349  	return &Value{data: groups}
   350  }
   351  
   352  // ReplaceStr uses the specified function to replace each strings
   353  // by iterating each item.  The data in the returned result will be a
   354  // []string containing the replaced items.
   355  func (v *Value) ReplaceStr(replacer func(int, string) string) *Value {
   356  	arr := v.MustStrSlice()
   357  	replaced := make([]string, len(arr))
   358  	v.EachStr(func(index int, val string) bool {
   359  		replaced[index] = replacer(index, val)
   360  		return true
   361  	})
   362  	return &Value{data: replaced}
   363  }
   364  
   365  // CollectStr uses the specified collector function to collect a value
   366  // for each of the strings in the slice.  The data returned will be a
   367  // []interface{}.
   368  func (v *Value) CollectStr(collector func(int, string) interface{}) *Value {
   369  	arr := v.MustStrSlice()
   370  	collected := make([]interface{}, len(arr))
   371  	v.EachStr(func(index int, val string) bool {
   372  		collected[index] = collector(index, val)
   373  		return true
   374  	})
   375  	return &Value{data: collected}
   376  }
   377  
   378  /*
   379     Int (int and []int)
   380  */
   381  
   382  // Int gets the value as a int, returns the optionalDefault
   383  // value or a system default object if the value is the wrong type.
   384  func (v *Value) Int(optionalDefault ...int) int {
   385  	if s, ok := v.data.(int); ok {
   386  		return s
   387  	}
   388  	if len(optionalDefault) == 1 {
   389  		return optionalDefault[0]
   390  	}
   391  	return 0
   392  }
   393  
   394  // MustInt gets the value as a int.
   395  //
   396  // Panics if the object is not a int.
   397  func (v *Value) MustInt() int {
   398  	return v.data.(int)
   399  }
   400  
   401  // IntSlice gets the value as a []int, returns the optionalDefault
   402  // value or nil if the value is not a []int.
   403  func (v *Value) IntSlice(optionalDefault ...[]int) []int {
   404  	if s, ok := v.data.([]int); ok {
   405  		return s
   406  	}
   407  	if len(optionalDefault) == 1 {
   408  		return optionalDefault[0]
   409  	}
   410  	return nil
   411  }
   412  
   413  // MustIntSlice gets the value as a []int.
   414  //
   415  // Panics if the object is not a []int.
   416  func (v *Value) MustIntSlice() []int {
   417  	return v.data.([]int)
   418  }
   419  
   420  // IsInt gets whether the object contained is a int or not.
   421  func (v *Value) IsInt() bool {
   422  	_, ok := v.data.(int)
   423  	return ok
   424  }
   425  
   426  // IsIntSlice gets whether the object contained is a []int or not.
   427  func (v *Value) IsIntSlice() bool {
   428  	_, ok := v.data.([]int)
   429  	return ok
   430  }
   431  
   432  // EachInt calls the specified callback for each object
   433  // in the []int.
   434  //
   435  // Panics if the object is the wrong type.
   436  func (v *Value) EachInt(callback func(int, int) bool) *Value {
   437  	for index, val := range v.MustIntSlice() {
   438  		carryon := callback(index, val)
   439  		if !carryon {
   440  			break
   441  		}
   442  	}
   443  	return v
   444  }
   445  
   446  // WhereInt uses the specified decider function to select items
   447  // from the []int.  The object contained in the result will contain
   448  // only the selected items.
   449  func (v *Value) WhereInt(decider func(int, int) bool) *Value {
   450  	var selected []int
   451  	v.EachInt(func(index int, val int) bool {
   452  		shouldSelect := decider(index, val)
   453  		if !shouldSelect {
   454  			selected = append(selected, val)
   455  		}
   456  		return true
   457  	})
   458  	return &Value{data: selected}
   459  }
   460  
   461  // GroupInt uses the specified grouper function to group the items
   462  // keyed by the return of the grouper.  The object contained in the
   463  // result will contain a map[string][]int.
   464  func (v *Value) GroupInt(grouper func(int, int) string) *Value {
   465  	groups := make(map[string][]int)
   466  	v.EachInt(func(index int, val int) bool {
   467  		group := grouper(index, val)
   468  		if _, ok := groups[group]; !ok {
   469  			groups[group] = make([]int, 0)
   470  		}
   471  		groups[group] = append(groups[group], val)
   472  		return true
   473  	})
   474  	return &Value{data: groups}
   475  }
   476  
   477  // ReplaceInt uses the specified function to replace each ints
   478  // by iterating each item.  The data in the returned result will be a
   479  // []int containing the replaced items.
   480  func (v *Value) ReplaceInt(replacer func(int, int) int) *Value {
   481  	arr := v.MustIntSlice()
   482  	replaced := make([]int, len(arr))
   483  	v.EachInt(func(index int, val int) bool {
   484  		replaced[index] = replacer(index, val)
   485  		return true
   486  	})
   487  	return &Value{data: replaced}
   488  }
   489  
   490  // CollectInt uses the specified collector function to collect a value
   491  // for each of the ints in the slice.  The data returned will be a
   492  // []interface{}.
   493  func (v *Value) CollectInt(collector func(int, int) interface{}) *Value {
   494  	arr := v.MustIntSlice()
   495  	collected := make([]interface{}, len(arr))
   496  	v.EachInt(func(index int, val int) bool {
   497  		collected[index] = collector(index, val)
   498  		return true
   499  	})
   500  	return &Value{data: collected}
   501  }
   502  
   503  /*
   504     Int8 (int8 and []int8)
   505  */
   506  
   507  // Int8 gets the value as a int8, returns the optionalDefault
   508  // value or a system default object if the value is the wrong type.
   509  func (v *Value) Int8(optionalDefault ...int8) int8 {
   510  	if s, ok := v.data.(int8); ok {
   511  		return s
   512  	}
   513  	if len(optionalDefault) == 1 {
   514  		return optionalDefault[0]
   515  	}
   516  	return 0
   517  }
   518  
   519  // MustInt8 gets the value as a int8.
   520  //
   521  // Panics if the object is not a int8.
   522  func (v *Value) MustInt8() int8 {
   523  	return v.data.(int8)
   524  }
   525  
   526  // Int8Slice gets the value as a []int8, returns the optionalDefault
   527  // value or nil if the value is not a []int8.
   528  func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 {
   529  	if s, ok := v.data.([]int8); ok {
   530  		return s
   531  	}
   532  	if len(optionalDefault) == 1 {
   533  		return optionalDefault[0]
   534  	}
   535  	return nil
   536  }
   537  
   538  // MustInt8Slice gets the value as a []int8.
   539  //
   540  // Panics if the object is not a []int8.
   541  func (v *Value) MustInt8Slice() []int8 {
   542  	return v.data.([]int8)
   543  }
   544  
   545  // IsInt8 gets whether the object contained is a int8 or not.
   546  func (v *Value) IsInt8() bool {
   547  	_, ok := v.data.(int8)
   548  	return ok
   549  }
   550  
   551  // IsInt8Slice gets whether the object contained is a []int8 or not.
   552  func (v *Value) IsInt8Slice() bool {
   553  	_, ok := v.data.([]int8)
   554  	return ok
   555  }
   556  
   557  // EachInt8 calls the specified callback for each object
   558  // in the []int8.
   559  //
   560  // Panics if the object is the wrong type.
   561  func (v *Value) EachInt8(callback func(int, int8) bool) *Value {
   562  	for index, val := range v.MustInt8Slice() {
   563  		carryon := callback(index, val)
   564  		if !carryon {
   565  			break
   566  		}
   567  	}
   568  	return v
   569  }
   570  
   571  // WhereInt8 uses the specified decider function to select items
   572  // from the []int8.  The object contained in the result will contain
   573  // only the selected items.
   574  func (v *Value) WhereInt8(decider func(int, int8) bool) *Value {
   575  	var selected []int8
   576  	v.EachInt8(func(index int, val int8) bool {
   577  		shouldSelect := decider(index, val)
   578  		if !shouldSelect {
   579  			selected = append(selected, val)
   580  		}
   581  		return true
   582  	})
   583  	return &Value{data: selected}
   584  }
   585  
   586  // GroupInt8 uses the specified grouper function to group the items
   587  // keyed by the return of the grouper.  The object contained in the
   588  // result will contain a map[string][]int8.
   589  func (v *Value) GroupInt8(grouper func(int, int8) string) *Value {
   590  	groups := make(map[string][]int8)
   591  	v.EachInt8(func(index int, val int8) bool {
   592  		group := grouper(index, val)
   593  		if _, ok := groups[group]; !ok {
   594  			groups[group] = make([]int8, 0)
   595  		}
   596  		groups[group] = append(groups[group], val)
   597  		return true
   598  	})
   599  	return &Value{data: groups}
   600  }
   601  
   602  // ReplaceInt8 uses the specified function to replace each int8s
   603  // by iterating each item.  The data in the returned result will be a
   604  // []int8 containing the replaced items.
   605  func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value {
   606  	arr := v.MustInt8Slice()
   607  	replaced := make([]int8, len(arr))
   608  	v.EachInt8(func(index int, val int8) bool {
   609  		replaced[index] = replacer(index, val)
   610  		return true
   611  	})
   612  	return &Value{data: replaced}
   613  }
   614  
   615  // CollectInt8 uses the specified collector function to collect a value
   616  // for each of the int8s in the slice.  The data returned will be a
   617  // []interface{}.
   618  func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value {
   619  	arr := v.MustInt8Slice()
   620  	collected := make([]interface{}, len(arr))
   621  	v.EachInt8(func(index int, val int8) bool {
   622  		collected[index] = collector(index, val)
   623  		return true
   624  	})
   625  	return &Value{data: collected}
   626  }
   627  
   628  /*
   629     Int16 (int16 and []int16)
   630  */
   631  
   632  // Int16 gets the value as a int16, returns the optionalDefault
   633  // value or a system default object if the value is the wrong type.
   634  func (v *Value) Int16(optionalDefault ...int16) int16 {
   635  	if s, ok := v.data.(int16); ok {
   636  		return s
   637  	}
   638  	if len(optionalDefault) == 1 {
   639  		return optionalDefault[0]
   640  	}
   641  	return 0
   642  }
   643  
   644  // MustInt16 gets the value as a int16.
   645  //
   646  // Panics if the object is not a int16.
   647  func (v *Value) MustInt16() int16 {
   648  	return v.data.(int16)
   649  }
   650  
   651  // Int16Slice gets the value as a []int16, returns the optionalDefault
   652  // value or nil if the value is not a []int16.
   653  func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 {
   654  	if s, ok := v.data.([]int16); ok {
   655  		return s
   656  	}
   657  	if len(optionalDefault) == 1 {
   658  		return optionalDefault[0]
   659  	}
   660  	return nil
   661  }
   662  
   663  // MustInt16Slice gets the value as a []int16.
   664  //
   665  // Panics if the object is not a []int16.
   666  func (v *Value) MustInt16Slice() []int16 {
   667  	return v.data.([]int16)
   668  }
   669  
   670  // IsInt16 gets whether the object contained is a int16 or not.
   671  func (v *Value) IsInt16() bool {
   672  	_, ok := v.data.(int16)
   673  	return ok
   674  }
   675  
   676  // IsInt16Slice gets whether the object contained is a []int16 or not.
   677  func (v *Value) IsInt16Slice() bool {
   678  	_, ok := v.data.([]int16)
   679  	return ok
   680  }
   681  
   682  // EachInt16 calls the specified callback for each object
   683  // in the []int16.
   684  //
   685  // Panics if the object is the wrong type.
   686  func (v *Value) EachInt16(callback func(int, int16) bool) *Value {
   687  	for index, val := range v.MustInt16Slice() {
   688  		carryon := callback(index, val)
   689  		if !carryon {
   690  			break
   691  		}
   692  	}
   693  	return v
   694  }
   695  
   696  // WhereInt16 uses the specified decider function to select items
   697  // from the []int16.  The object contained in the result will contain
   698  // only the selected items.
   699  func (v *Value) WhereInt16(decider func(int, int16) bool) *Value {
   700  	var selected []int16
   701  	v.EachInt16(func(index int, val int16) bool {
   702  		shouldSelect := decider(index, val)
   703  		if !shouldSelect {
   704  			selected = append(selected, val)
   705  		}
   706  		return true
   707  	})
   708  	return &Value{data: selected}
   709  }
   710  
   711  // GroupInt16 uses the specified grouper function to group the items
   712  // keyed by the return of the grouper.  The object contained in the
   713  // result will contain a map[string][]int16.
   714  func (v *Value) GroupInt16(grouper func(int, int16) string) *Value {
   715  	groups := make(map[string][]int16)
   716  	v.EachInt16(func(index int, val int16) bool {
   717  		group := grouper(index, val)
   718  		if _, ok := groups[group]; !ok {
   719  			groups[group] = make([]int16, 0)
   720  		}
   721  		groups[group] = append(groups[group], val)
   722  		return true
   723  	})
   724  	return &Value{data: groups}
   725  }
   726  
   727  // ReplaceInt16 uses the specified function to replace each int16s
   728  // by iterating each item.  The data in the returned result will be a
   729  // []int16 containing the replaced items.
   730  func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value {
   731  	arr := v.MustInt16Slice()
   732  	replaced := make([]int16, len(arr))
   733  	v.EachInt16(func(index int, val int16) bool {
   734  		replaced[index] = replacer(index, val)
   735  		return true
   736  	})
   737  	return &Value{data: replaced}
   738  }
   739  
   740  // CollectInt16 uses the specified collector function to collect a value
   741  // for each of the int16s in the slice.  The data returned will be a
   742  // []interface{}.
   743  func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value {
   744  	arr := v.MustInt16Slice()
   745  	collected := make([]interface{}, len(arr))
   746  	v.EachInt16(func(index int, val int16) bool {
   747  		collected[index] = collector(index, val)
   748  		return true
   749  	})
   750  	return &Value{data: collected}
   751  }
   752  
   753  /*
   754     Int32 (int32 and []int32)
   755  */
   756  
   757  // Int32 gets the value as a int32, returns the optionalDefault
   758  // value or a system default object if the value is the wrong type.
   759  func (v *Value) Int32(optionalDefault ...int32) int32 {
   760  	if s, ok := v.data.(int32); ok {
   761  		return s
   762  	}
   763  	if len(optionalDefault) == 1 {
   764  		return optionalDefault[0]
   765  	}
   766  	return 0
   767  }
   768  
   769  // MustInt32 gets the value as a int32.
   770  //
   771  // Panics if the object is not a int32.
   772  func (v *Value) MustInt32() int32 {
   773  	return v.data.(int32)
   774  }
   775  
   776  // Int32Slice gets the value as a []int32, returns the optionalDefault
   777  // value or nil if the value is not a []int32.
   778  func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 {
   779  	if s, ok := v.data.([]int32); ok {
   780  		return s
   781  	}
   782  	if len(optionalDefault) == 1 {
   783  		return optionalDefault[0]
   784  	}
   785  	return nil
   786  }
   787  
   788  // MustInt32Slice gets the value as a []int32.
   789  //
   790  // Panics if the object is not a []int32.
   791  func (v *Value) MustInt32Slice() []int32 {
   792  	return v.data.([]int32)
   793  }
   794  
   795  // IsInt32 gets whether the object contained is a int32 or not.
   796  func (v *Value) IsInt32() bool {
   797  	_, ok := v.data.(int32)
   798  	return ok
   799  }
   800  
   801  // IsInt32Slice gets whether the object contained is a []int32 or not.
   802  func (v *Value) IsInt32Slice() bool {
   803  	_, ok := v.data.([]int32)
   804  	return ok
   805  }
   806  
   807  // EachInt32 calls the specified callback for each object
   808  // in the []int32.
   809  //
   810  // Panics if the object is the wrong type.
   811  func (v *Value) EachInt32(callback func(int, int32) bool) *Value {
   812  	for index, val := range v.MustInt32Slice() {
   813  		carryon := callback(index, val)
   814  		if !carryon {
   815  			break
   816  		}
   817  	}
   818  	return v
   819  }
   820  
   821  // WhereInt32 uses the specified decider function to select items
   822  // from the []int32.  The object contained in the result will contain
   823  // only the selected items.
   824  func (v *Value) WhereInt32(decider func(int, int32) bool) *Value {
   825  	var selected []int32
   826  	v.EachInt32(func(index int, val int32) bool {
   827  		shouldSelect := decider(index, val)
   828  		if !shouldSelect {
   829  			selected = append(selected, val)
   830  		}
   831  		return true
   832  	})
   833  	return &Value{data: selected}
   834  }
   835  
   836  // GroupInt32 uses the specified grouper function to group the items
   837  // keyed by the return of the grouper.  The object contained in the
   838  // result will contain a map[string][]int32.
   839  func (v *Value) GroupInt32(grouper func(int, int32) string) *Value {
   840  	groups := make(map[string][]int32)
   841  	v.EachInt32(func(index int, val int32) bool {
   842  		group := grouper(index, val)
   843  		if _, ok := groups[group]; !ok {
   844  			groups[group] = make([]int32, 0)
   845  		}
   846  		groups[group] = append(groups[group], val)
   847  		return true
   848  	})
   849  	return &Value{data: groups}
   850  }
   851  
   852  // ReplaceInt32 uses the specified function to replace each int32s
   853  // by iterating each item.  The data in the returned result will be a
   854  // []int32 containing the replaced items.
   855  func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value {
   856  	arr := v.MustInt32Slice()
   857  	replaced := make([]int32, len(arr))
   858  	v.EachInt32(func(index int, val int32) bool {
   859  		replaced[index] = replacer(index, val)
   860  		return true
   861  	})
   862  	return &Value{data: replaced}
   863  }
   864  
   865  // CollectInt32 uses the specified collector function to collect a value
   866  // for each of the int32s in the slice.  The data returned will be a
   867  // []interface{}.
   868  func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value {
   869  	arr := v.MustInt32Slice()
   870  	collected := make([]interface{}, len(arr))
   871  	v.EachInt32(func(index int, val int32) bool {
   872  		collected[index] = collector(index, val)
   873  		return true
   874  	})
   875  	return &Value{data: collected}
   876  }
   877  
   878  /*
   879     Int64 (int64 and []int64)
   880  */
   881  
   882  // Int64 gets the value as a int64, returns the optionalDefault
   883  // value or a system default object if the value is the wrong type.
   884  func (v *Value) Int64(optionalDefault ...int64) int64 {
   885  	if s, ok := v.data.(int64); ok {
   886  		return s
   887  	}
   888  	if len(optionalDefault) == 1 {
   889  		return optionalDefault[0]
   890  	}
   891  	return 0
   892  }
   893  
   894  // MustInt64 gets the value as a int64.
   895  //
   896  // Panics if the object is not a int64.
   897  func (v *Value) MustInt64() int64 {
   898  	return v.data.(int64)
   899  }
   900  
   901  // Int64Slice gets the value as a []int64, returns the optionalDefault
   902  // value or nil if the value is not a []int64.
   903  func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 {
   904  	if s, ok := v.data.([]int64); ok {
   905  		return s
   906  	}
   907  	if len(optionalDefault) == 1 {
   908  		return optionalDefault[0]
   909  	}
   910  	return nil
   911  }
   912  
   913  // MustInt64Slice gets the value as a []int64.
   914  //
   915  // Panics if the object is not a []int64.
   916  func (v *Value) MustInt64Slice() []int64 {
   917  	return v.data.([]int64)
   918  }
   919  
   920  // IsInt64 gets whether the object contained is a int64 or not.
   921  func (v *Value) IsInt64() bool {
   922  	_, ok := v.data.(int64)
   923  	return ok
   924  }
   925  
   926  // IsInt64Slice gets whether the object contained is a []int64 or not.
   927  func (v *Value) IsInt64Slice() bool {
   928  	_, ok := v.data.([]int64)
   929  	return ok
   930  }
   931  
   932  // EachInt64 calls the specified callback for each object
   933  // in the []int64.
   934  //
   935  // Panics if the object is the wrong type.
   936  func (v *Value) EachInt64(callback func(int, int64) bool) *Value {
   937  	for index, val := range v.MustInt64Slice() {
   938  		carryon := callback(index, val)
   939  		if !carryon {
   940  			break
   941  		}
   942  	}
   943  	return v
   944  }
   945  
   946  // WhereInt64 uses the specified decider function to select items
   947  // from the []int64.  The object contained in the result will contain
   948  // only the selected items.
   949  func (v *Value) WhereInt64(decider func(int, int64) bool) *Value {
   950  	var selected []int64
   951  	v.EachInt64(func(index int, val int64) bool {
   952  		shouldSelect := decider(index, val)
   953  		if !shouldSelect {
   954  			selected = append(selected, val)
   955  		}
   956  		return true
   957  	})
   958  	return &Value{data: selected}
   959  }
   960  
   961  // GroupInt64 uses the specified grouper function to group the items
   962  // keyed by the return of the grouper.  The object contained in the
   963  // result will contain a map[string][]int64.
   964  func (v *Value) GroupInt64(grouper func(int, int64) string) *Value {
   965  	groups := make(map[string][]int64)
   966  	v.EachInt64(func(index int, val int64) bool {
   967  		group := grouper(index, val)
   968  		if _, ok := groups[group]; !ok {
   969  			groups[group] = make([]int64, 0)
   970  		}
   971  		groups[group] = append(groups[group], val)
   972  		return true
   973  	})
   974  	return &Value{data: groups}
   975  }
   976  
   977  // ReplaceInt64 uses the specified function to replace each int64s
   978  // by iterating each item.  The data in the returned result will be a
   979  // []int64 containing the replaced items.
   980  func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value {
   981  	arr := v.MustInt64Slice()
   982  	replaced := make([]int64, len(arr))
   983  	v.EachInt64(func(index int, val int64) bool {
   984  		replaced[index] = replacer(index, val)
   985  		return true
   986  	})
   987  	return &Value{data: replaced}
   988  }
   989  
   990  // CollectInt64 uses the specified collector function to collect a value
   991  // for each of the int64s in the slice.  The data returned will be a
   992  // []interface{}.
   993  func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value {
   994  	arr := v.MustInt64Slice()
   995  	collected := make([]interface{}, len(arr))
   996  	v.EachInt64(func(index int, val int64) bool {
   997  		collected[index] = collector(index, val)
   998  		return true
   999  	})
  1000  	return &Value{data: collected}
  1001  }
  1002  
  1003  /*
  1004     Uint (uint and []uint)
  1005  */
  1006  
  1007  // Uint gets the value as a uint, returns the optionalDefault
  1008  // value or a system default object if the value is the wrong type.
  1009  func (v *Value) Uint(optionalDefault ...uint) uint {
  1010  	if s, ok := v.data.(uint); ok {
  1011  		return s
  1012  	}
  1013  	if len(optionalDefault) == 1 {
  1014  		return optionalDefault[0]
  1015  	}
  1016  	return 0
  1017  }
  1018  
  1019  // MustUint gets the value as a uint.
  1020  //
  1021  // Panics if the object is not a uint.
  1022  func (v *Value) MustUint() uint {
  1023  	return v.data.(uint)
  1024  }
  1025  
  1026  // UintSlice gets the value as a []uint, returns the optionalDefault
  1027  // value or nil if the value is not a []uint.
  1028  func (v *Value) UintSlice(optionalDefault ...[]uint) []uint {
  1029  	if s, ok := v.data.([]uint); ok {
  1030  		return s
  1031  	}
  1032  	if len(optionalDefault) == 1 {
  1033  		return optionalDefault[0]
  1034  	}
  1035  	return nil
  1036  }
  1037  
  1038  // MustUintSlice gets the value as a []uint.
  1039  //
  1040  // Panics if the object is not a []uint.
  1041  func (v *Value) MustUintSlice() []uint {
  1042  	return v.data.([]uint)
  1043  }
  1044  
  1045  // IsUint gets whether the object contained is a uint or not.
  1046  func (v *Value) IsUint() bool {
  1047  	_, ok := v.data.(uint)
  1048  	return ok
  1049  }
  1050  
  1051  // IsUintSlice gets whether the object contained is a []uint or not.
  1052  func (v *Value) IsUintSlice() bool {
  1053  	_, ok := v.data.([]uint)
  1054  	return ok
  1055  }
  1056  
  1057  // EachUint calls the specified callback for each object
  1058  // in the []uint.
  1059  //
  1060  // Panics if the object is the wrong type.
  1061  func (v *Value) EachUint(callback func(int, uint) bool) *Value {
  1062  	for index, val := range v.MustUintSlice() {
  1063  		carryon := callback(index, val)
  1064  		if !carryon {
  1065  			break
  1066  		}
  1067  	}
  1068  	return v
  1069  }
  1070  
  1071  // WhereUint uses the specified decider function to select items
  1072  // from the []uint.  The object contained in the result will contain
  1073  // only the selected items.
  1074  func (v *Value) WhereUint(decider func(int, uint) bool) *Value {
  1075  	var selected []uint
  1076  	v.EachUint(func(index int, val uint) bool {
  1077  		shouldSelect := decider(index, val)
  1078  		if !shouldSelect {
  1079  			selected = append(selected, val)
  1080  		}
  1081  		return true
  1082  	})
  1083  	return &Value{data: selected}
  1084  }
  1085  
  1086  // GroupUint uses the specified grouper function to group the items
  1087  // keyed by the return of the grouper.  The object contained in the
  1088  // result will contain a map[string][]uint.
  1089  func (v *Value) GroupUint(grouper func(int, uint) string) *Value {
  1090  	groups := make(map[string][]uint)
  1091  	v.EachUint(func(index int, val uint) bool {
  1092  		group := grouper(index, val)
  1093  		if _, ok := groups[group]; !ok {
  1094  			groups[group] = make([]uint, 0)
  1095  		}
  1096  		groups[group] = append(groups[group], val)
  1097  		return true
  1098  	})
  1099  	return &Value{data: groups}
  1100  }
  1101  
  1102  // ReplaceUint uses the specified function to replace each uints
  1103  // by iterating each item.  The data in the returned result will be a
  1104  // []uint containing the replaced items.
  1105  func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value {
  1106  	arr := v.MustUintSlice()
  1107  	replaced := make([]uint, len(arr))
  1108  	v.EachUint(func(index int, val uint) bool {
  1109  		replaced[index] = replacer(index, val)
  1110  		return true
  1111  	})
  1112  	return &Value{data: replaced}
  1113  }
  1114  
  1115  // CollectUint uses the specified collector function to collect a value
  1116  // for each of the uints in the slice.  The data returned will be a
  1117  // []interface{}.
  1118  func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value {
  1119  	arr := v.MustUintSlice()
  1120  	collected := make([]interface{}, len(arr))
  1121  	v.EachUint(func(index int, val uint) bool {
  1122  		collected[index] = collector(index, val)
  1123  		return true
  1124  	})
  1125  	return &Value{data: collected}
  1126  }
  1127  
  1128  /*
  1129     Uint8 (uint8 and []uint8)
  1130  */
  1131  
  1132  // Uint8 gets the value as a uint8, returns the optionalDefault
  1133  // value or a system default object if the value is the wrong type.
  1134  func (v *Value) Uint8(optionalDefault ...uint8) uint8 {
  1135  	if s, ok := v.data.(uint8); ok {
  1136  		return s
  1137  	}
  1138  	if len(optionalDefault) == 1 {
  1139  		return optionalDefault[0]
  1140  	}
  1141  	return 0
  1142  }
  1143  
  1144  // MustUint8 gets the value as a uint8.
  1145  //
  1146  // Panics if the object is not a uint8.
  1147  func (v *Value) MustUint8() uint8 {
  1148  	return v.data.(uint8)
  1149  }
  1150  
  1151  // Uint8Slice gets the value as a []uint8, returns the optionalDefault
  1152  // value or nil if the value is not a []uint8.
  1153  func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 {
  1154  	if s, ok := v.data.([]uint8); ok {
  1155  		return s
  1156  	}
  1157  	if len(optionalDefault) == 1 {
  1158  		return optionalDefault[0]
  1159  	}
  1160  	return nil
  1161  }
  1162  
  1163  // MustUint8Slice gets the value as a []uint8.
  1164  //
  1165  // Panics if the object is not a []uint8.
  1166  func (v *Value) MustUint8Slice() []uint8 {
  1167  	return v.data.([]uint8)
  1168  }
  1169  
  1170  // IsUint8 gets whether the object contained is a uint8 or not.
  1171  func (v *Value) IsUint8() bool {
  1172  	_, ok := v.data.(uint8)
  1173  	return ok
  1174  }
  1175  
  1176  // IsUint8Slice gets whether the object contained is a []uint8 or not.
  1177  func (v *Value) IsUint8Slice() bool {
  1178  	_, ok := v.data.([]uint8)
  1179  	return ok
  1180  }
  1181  
  1182  // EachUint8 calls the specified callback for each object
  1183  // in the []uint8.
  1184  //
  1185  // Panics if the object is the wrong type.
  1186  func (v *Value) EachUint8(callback func(int, uint8) bool) *Value {
  1187  	for index, val := range v.MustUint8Slice() {
  1188  		carryon := callback(index, val)
  1189  		if !carryon {
  1190  			break
  1191  		}
  1192  	}
  1193  	return v
  1194  }
  1195  
  1196  // WhereUint8 uses the specified decider function to select items
  1197  // from the []uint8.  The object contained in the result will contain
  1198  // only the selected items.
  1199  func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value {
  1200  	var selected []uint8
  1201  	v.EachUint8(func(index int, val uint8) bool {
  1202  		shouldSelect := decider(index, val)
  1203  		if !shouldSelect {
  1204  			selected = append(selected, val)
  1205  		}
  1206  		return true
  1207  	})
  1208  	return &Value{data: selected}
  1209  }
  1210  
  1211  // GroupUint8 uses the specified grouper function to group the items
  1212  // keyed by the return of the grouper.  The object contained in the
  1213  // result will contain a map[string][]uint8.
  1214  func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value {
  1215  	groups := make(map[string][]uint8)
  1216  	v.EachUint8(func(index int, val uint8) bool {
  1217  		group := grouper(index, val)
  1218  		if _, ok := groups[group]; !ok {
  1219  			groups[group] = make([]uint8, 0)
  1220  		}
  1221  		groups[group] = append(groups[group], val)
  1222  		return true
  1223  	})
  1224  	return &Value{data: groups}
  1225  }
  1226  
  1227  // ReplaceUint8 uses the specified function to replace each uint8s
  1228  // by iterating each item.  The data in the returned result will be a
  1229  // []uint8 containing the replaced items.
  1230  func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value {
  1231  	arr := v.MustUint8Slice()
  1232  	replaced := make([]uint8, len(arr))
  1233  	v.EachUint8(func(index int, val uint8) bool {
  1234  		replaced[index] = replacer(index, val)
  1235  		return true
  1236  	})
  1237  	return &Value{data: replaced}
  1238  }
  1239  
  1240  // CollectUint8 uses the specified collector function to collect a value
  1241  // for each of the uint8s in the slice.  The data returned will be a
  1242  // []interface{}.
  1243  func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value {
  1244  	arr := v.MustUint8Slice()
  1245  	collected := make([]interface{}, len(arr))
  1246  	v.EachUint8(func(index int, val uint8) bool {
  1247  		collected[index] = collector(index, val)
  1248  		return true
  1249  	})
  1250  	return &Value{data: collected}
  1251  }
  1252  
  1253  /*
  1254     Uint16 (uint16 and []uint16)
  1255  */
  1256  
  1257  // Uint16 gets the value as a uint16, returns the optionalDefault
  1258  // value or a system default object if the value is the wrong type.
  1259  func (v *Value) Uint16(optionalDefault ...uint16) uint16 {
  1260  	if s, ok := v.data.(uint16); ok {
  1261  		return s
  1262  	}
  1263  	if len(optionalDefault) == 1 {
  1264  		return optionalDefault[0]
  1265  	}
  1266  	return 0
  1267  }
  1268  
  1269  // MustUint16 gets the value as a uint16.
  1270  //
  1271  // Panics if the object is not a uint16.
  1272  func (v *Value) MustUint16() uint16 {
  1273  	return v.data.(uint16)
  1274  }
  1275  
  1276  // Uint16Slice gets the value as a []uint16, returns the optionalDefault
  1277  // value or nil if the value is not a []uint16.
  1278  func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 {
  1279  	if s, ok := v.data.([]uint16); ok {
  1280  		return s
  1281  	}
  1282  	if len(optionalDefault) == 1 {
  1283  		return optionalDefault[0]
  1284  	}
  1285  	return nil
  1286  }
  1287  
  1288  // MustUint16Slice gets the value as a []uint16.
  1289  //
  1290  // Panics if the object is not a []uint16.
  1291  func (v *Value) MustUint16Slice() []uint16 {
  1292  	return v.data.([]uint16)
  1293  }
  1294  
  1295  // IsUint16 gets whether the object contained is a uint16 or not.
  1296  func (v *Value) IsUint16() bool {
  1297  	_, ok := v.data.(uint16)
  1298  	return ok
  1299  }
  1300  
  1301  // IsUint16Slice gets whether the object contained is a []uint16 or not.
  1302  func (v *Value) IsUint16Slice() bool {
  1303  	_, ok := v.data.([]uint16)
  1304  	return ok
  1305  }
  1306  
  1307  // EachUint16 calls the specified callback for each object
  1308  // in the []uint16.
  1309  //
  1310  // Panics if the object is the wrong type.
  1311  func (v *Value) EachUint16(callback func(int, uint16) bool) *Value {
  1312  	for index, val := range v.MustUint16Slice() {
  1313  		carryon := callback(index, val)
  1314  		if !carryon {
  1315  			break
  1316  		}
  1317  	}
  1318  	return v
  1319  }
  1320  
  1321  // WhereUint16 uses the specified decider function to select items
  1322  // from the []uint16.  The object contained in the result will contain
  1323  // only the selected items.
  1324  func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value {
  1325  	var selected []uint16
  1326  	v.EachUint16(func(index int, val uint16) bool {
  1327  		shouldSelect := decider(index, val)
  1328  		if !shouldSelect {
  1329  			selected = append(selected, val)
  1330  		}
  1331  		return true
  1332  	})
  1333  	return &Value{data: selected}
  1334  }
  1335  
  1336  // GroupUint16 uses the specified grouper function to group the items
  1337  // keyed by the return of the grouper.  The object contained in the
  1338  // result will contain a map[string][]uint16.
  1339  func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value {
  1340  	groups := make(map[string][]uint16)
  1341  	v.EachUint16(func(index int, val uint16) bool {
  1342  		group := grouper(index, val)
  1343  		if _, ok := groups[group]; !ok {
  1344  			groups[group] = make([]uint16, 0)
  1345  		}
  1346  		groups[group] = append(groups[group], val)
  1347  		return true
  1348  	})
  1349  	return &Value{data: groups}
  1350  }
  1351  
  1352  // ReplaceUint16 uses the specified function to replace each uint16s
  1353  // by iterating each item.  The data in the returned result will be a
  1354  // []uint16 containing the replaced items.
  1355  func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value {
  1356  	arr := v.MustUint16Slice()
  1357  	replaced := make([]uint16, len(arr))
  1358  	v.EachUint16(func(index int, val uint16) bool {
  1359  		replaced[index] = replacer(index, val)
  1360  		return true
  1361  	})
  1362  	return &Value{data: replaced}
  1363  }
  1364  
  1365  // CollectUint16 uses the specified collector function to collect a value
  1366  // for each of the uint16s in the slice.  The data returned will be a
  1367  // []interface{}.
  1368  func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value {
  1369  	arr := v.MustUint16Slice()
  1370  	collected := make([]interface{}, len(arr))
  1371  	v.EachUint16(func(index int, val uint16) bool {
  1372  		collected[index] = collector(index, val)
  1373  		return true
  1374  	})
  1375  	return &Value{data: collected}
  1376  }
  1377  
  1378  /*
  1379     Uint32 (uint32 and []uint32)
  1380  */
  1381  
  1382  // Uint32 gets the value as a uint32, returns the optionalDefault
  1383  // value or a system default object if the value is the wrong type.
  1384  func (v *Value) Uint32(optionalDefault ...uint32) uint32 {
  1385  	if s, ok := v.data.(uint32); ok {
  1386  		return s
  1387  	}
  1388  	if len(optionalDefault) == 1 {
  1389  		return optionalDefault[0]
  1390  	}
  1391  	return 0
  1392  }
  1393  
  1394  // MustUint32 gets the value as a uint32.
  1395  //
  1396  // Panics if the object is not a uint32.
  1397  func (v *Value) MustUint32() uint32 {
  1398  	return v.data.(uint32)
  1399  }
  1400  
  1401  // Uint32Slice gets the value as a []uint32, returns the optionalDefault
  1402  // value or nil if the value is not a []uint32.
  1403  func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 {
  1404  	if s, ok := v.data.([]uint32); ok {
  1405  		return s
  1406  	}
  1407  	if len(optionalDefault) == 1 {
  1408  		return optionalDefault[0]
  1409  	}
  1410  	return nil
  1411  }
  1412  
  1413  // MustUint32Slice gets the value as a []uint32.
  1414  //
  1415  // Panics if the object is not a []uint32.
  1416  func (v *Value) MustUint32Slice() []uint32 {
  1417  	return v.data.([]uint32)
  1418  }
  1419  
  1420  // IsUint32 gets whether the object contained is a uint32 or not.
  1421  func (v *Value) IsUint32() bool {
  1422  	_, ok := v.data.(uint32)
  1423  	return ok
  1424  }
  1425  
  1426  // IsUint32Slice gets whether the object contained is a []uint32 or not.
  1427  func (v *Value) IsUint32Slice() bool {
  1428  	_, ok := v.data.([]uint32)
  1429  	return ok
  1430  }
  1431  
  1432  // EachUint32 calls the specified callback for each object
  1433  // in the []uint32.
  1434  //
  1435  // Panics if the object is the wrong type.
  1436  func (v *Value) EachUint32(callback func(int, uint32) bool) *Value {
  1437  	for index, val := range v.MustUint32Slice() {
  1438  		carryon := callback(index, val)
  1439  		if !carryon {
  1440  			break
  1441  		}
  1442  	}
  1443  	return v
  1444  }
  1445  
  1446  // WhereUint32 uses the specified decider function to select items
  1447  // from the []uint32.  The object contained in the result will contain
  1448  // only the selected items.
  1449  func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value {
  1450  	var selected []uint32
  1451  	v.EachUint32(func(index int, val uint32) bool {
  1452  		shouldSelect := decider(index, val)
  1453  		if !shouldSelect {
  1454  			selected = append(selected, val)
  1455  		}
  1456  		return true
  1457  	})
  1458  	return &Value{data: selected}
  1459  }
  1460  
  1461  // GroupUint32 uses the specified grouper function to group the items
  1462  // keyed by the return of the grouper.  The object contained in the
  1463  // result will contain a map[string][]uint32.
  1464  func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value {
  1465  	groups := make(map[string][]uint32)
  1466  	v.EachUint32(func(index int, val uint32) bool {
  1467  		group := grouper(index, val)
  1468  		if _, ok := groups[group]; !ok {
  1469  			groups[group] = make([]uint32, 0)
  1470  		}
  1471  		groups[group] = append(groups[group], val)
  1472  		return true
  1473  	})
  1474  	return &Value{data: groups}
  1475  }
  1476  
  1477  // ReplaceUint32 uses the specified function to replace each uint32s
  1478  // by iterating each item.  The data in the returned result will be a
  1479  // []uint32 containing the replaced items.
  1480  func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value {
  1481  	arr := v.MustUint32Slice()
  1482  	replaced := make([]uint32, len(arr))
  1483  	v.EachUint32(func(index int, val uint32) bool {
  1484  		replaced[index] = replacer(index, val)
  1485  		return true
  1486  	})
  1487  	return &Value{data: replaced}
  1488  }
  1489  
  1490  // CollectUint32 uses the specified collector function to collect a value
  1491  // for each of the uint32s in the slice.  The data returned will be a
  1492  // []interface{}.
  1493  func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value {
  1494  	arr := v.MustUint32Slice()
  1495  	collected := make([]interface{}, len(arr))
  1496  	v.EachUint32(func(index int, val uint32) bool {
  1497  		collected[index] = collector(index, val)
  1498  		return true
  1499  	})
  1500  	return &Value{data: collected}
  1501  }
  1502  
  1503  /*
  1504     Uint64 (uint64 and []uint64)
  1505  */
  1506  
  1507  // Uint64 gets the value as a uint64, returns the optionalDefault
  1508  // value or a system default object if the value is the wrong type.
  1509  func (v *Value) Uint64(optionalDefault ...uint64) uint64 {
  1510  	if s, ok := v.data.(uint64); ok {
  1511  		return s
  1512  	}
  1513  	if len(optionalDefault) == 1 {
  1514  		return optionalDefault[0]
  1515  	}
  1516  	return 0
  1517  }
  1518  
  1519  // MustUint64 gets the value as a uint64.
  1520  //
  1521  // Panics if the object is not a uint64.
  1522  func (v *Value) MustUint64() uint64 {
  1523  	return v.data.(uint64)
  1524  }
  1525  
  1526  // Uint64Slice gets the value as a []uint64, returns the optionalDefault
  1527  // value or nil if the value is not a []uint64.
  1528  func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 {
  1529  	if s, ok := v.data.([]uint64); ok {
  1530  		return s
  1531  	}
  1532  	if len(optionalDefault) == 1 {
  1533  		return optionalDefault[0]
  1534  	}
  1535  	return nil
  1536  }
  1537  
  1538  // MustUint64Slice gets the value as a []uint64.
  1539  //
  1540  // Panics if the object is not a []uint64.
  1541  func (v *Value) MustUint64Slice() []uint64 {
  1542  	return v.data.([]uint64)
  1543  }
  1544  
  1545  // IsUint64 gets whether the object contained is a uint64 or not.
  1546  func (v *Value) IsUint64() bool {
  1547  	_, ok := v.data.(uint64)
  1548  	return ok
  1549  }
  1550  
  1551  // IsUint64Slice gets whether the object contained is a []uint64 or not.
  1552  func (v *Value) IsUint64Slice() bool {
  1553  	_, ok := v.data.([]uint64)
  1554  	return ok
  1555  }
  1556  
  1557  // EachUint64 calls the specified callback for each object
  1558  // in the []uint64.
  1559  //
  1560  // Panics if the object is the wrong type.
  1561  func (v *Value) EachUint64(callback func(int, uint64) bool) *Value {
  1562  	for index, val := range v.MustUint64Slice() {
  1563  		carryon := callback(index, val)
  1564  		if !carryon {
  1565  			break
  1566  		}
  1567  	}
  1568  	return v
  1569  }
  1570  
  1571  // WhereUint64 uses the specified decider function to select items
  1572  // from the []uint64.  The object contained in the result will contain
  1573  // only the selected items.
  1574  func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value {
  1575  	var selected []uint64
  1576  	v.EachUint64(func(index int, val uint64) bool {
  1577  		shouldSelect := decider(index, val)
  1578  		if !shouldSelect {
  1579  			selected = append(selected, val)
  1580  		}
  1581  		return true
  1582  	})
  1583  	return &Value{data: selected}
  1584  }
  1585  
  1586  // GroupUint64 uses the specified grouper function to group the items
  1587  // keyed by the return of the grouper.  The object contained in the
  1588  // result will contain a map[string][]uint64.
  1589  func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value {
  1590  	groups := make(map[string][]uint64)
  1591  	v.EachUint64(func(index int, val uint64) bool {
  1592  		group := grouper(index, val)
  1593  		if _, ok := groups[group]; !ok {
  1594  			groups[group] = make([]uint64, 0)
  1595  		}
  1596  		groups[group] = append(groups[group], val)
  1597  		return true
  1598  	})
  1599  	return &Value{data: groups}
  1600  }
  1601  
  1602  // ReplaceUint64 uses the specified function to replace each uint64s
  1603  // by iterating each item.  The data in the returned result will be a
  1604  // []uint64 containing the replaced items.
  1605  func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value {
  1606  	arr := v.MustUint64Slice()
  1607  	replaced := make([]uint64, len(arr))
  1608  	v.EachUint64(func(index int, val uint64) bool {
  1609  		replaced[index] = replacer(index, val)
  1610  		return true
  1611  	})
  1612  	return &Value{data: replaced}
  1613  }
  1614  
  1615  // CollectUint64 uses the specified collector function to collect a value
  1616  // for each of the uint64s in the slice.  The data returned will be a
  1617  // []interface{}.
  1618  func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value {
  1619  	arr := v.MustUint64Slice()
  1620  	collected := make([]interface{}, len(arr))
  1621  	v.EachUint64(func(index int, val uint64) bool {
  1622  		collected[index] = collector(index, val)
  1623  		return true
  1624  	})
  1625  	return &Value{data: collected}
  1626  }
  1627  
  1628  /*
  1629     Uintptr (uintptr and []uintptr)
  1630  */
  1631  
  1632  // Uintptr gets the value as a uintptr, returns the optionalDefault
  1633  // value or a system default object if the value is the wrong type.
  1634  func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr {
  1635  	if s, ok := v.data.(uintptr); ok {
  1636  		return s
  1637  	}
  1638  	if len(optionalDefault) == 1 {
  1639  		return optionalDefault[0]
  1640  	}
  1641  	return 0
  1642  }
  1643  
  1644  // MustUintptr gets the value as a uintptr.
  1645  //
  1646  // Panics if the object is not a uintptr.
  1647  func (v *Value) MustUintptr() uintptr {
  1648  	return v.data.(uintptr)
  1649  }
  1650  
  1651  // UintptrSlice gets the value as a []uintptr, returns the optionalDefault
  1652  // value or nil if the value is not a []uintptr.
  1653  func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr {
  1654  	if s, ok := v.data.([]uintptr); ok {
  1655  		return s
  1656  	}
  1657  	if len(optionalDefault) == 1 {
  1658  		return optionalDefault[0]
  1659  	}
  1660  	return nil
  1661  }
  1662  
  1663  // MustUintptrSlice gets the value as a []uintptr.
  1664  //
  1665  // Panics if the object is not a []uintptr.
  1666  func (v *Value) MustUintptrSlice() []uintptr {
  1667  	return v.data.([]uintptr)
  1668  }
  1669  
  1670  // IsUintptr gets whether the object contained is a uintptr or not.
  1671  func (v *Value) IsUintptr() bool {
  1672  	_, ok := v.data.(uintptr)
  1673  	return ok
  1674  }
  1675  
  1676  // IsUintptrSlice gets whether the object contained is a []uintptr or not.
  1677  func (v *Value) IsUintptrSlice() bool {
  1678  	_, ok := v.data.([]uintptr)
  1679  	return ok
  1680  }
  1681  
  1682  // EachUintptr calls the specified callback for each object
  1683  // in the []uintptr.
  1684  //
  1685  // Panics if the object is the wrong type.
  1686  func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value {
  1687  	for index, val := range v.MustUintptrSlice() {
  1688  		carryon := callback(index, val)
  1689  		if !carryon {
  1690  			break
  1691  		}
  1692  	}
  1693  	return v
  1694  }
  1695  
  1696  // WhereUintptr uses the specified decider function to select items
  1697  // from the []uintptr.  The object contained in the result will contain
  1698  // only the selected items.
  1699  func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value {
  1700  	var selected []uintptr
  1701  	v.EachUintptr(func(index int, val uintptr) bool {
  1702  		shouldSelect := decider(index, val)
  1703  		if !shouldSelect {
  1704  			selected = append(selected, val)
  1705  		}
  1706  		return true
  1707  	})
  1708  	return &Value{data: selected}
  1709  }
  1710  
  1711  // GroupUintptr uses the specified grouper function to group the items
  1712  // keyed by the return of the grouper.  The object contained in the
  1713  // result will contain a map[string][]uintptr.
  1714  func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value {
  1715  	groups := make(map[string][]uintptr)
  1716  	v.EachUintptr(func(index int, val uintptr) bool {
  1717  		group := grouper(index, val)
  1718  		if _, ok := groups[group]; !ok {
  1719  			groups[group] = make([]uintptr, 0)
  1720  		}
  1721  		groups[group] = append(groups[group], val)
  1722  		return true
  1723  	})
  1724  	return &Value{data: groups}
  1725  }
  1726  
  1727  // ReplaceUintptr uses the specified function to replace each uintptrs
  1728  // by iterating each item.  The data in the returned result will be a
  1729  // []uintptr containing the replaced items.
  1730  func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value {
  1731  	arr := v.MustUintptrSlice()
  1732  	replaced := make([]uintptr, len(arr))
  1733  	v.EachUintptr(func(index int, val uintptr) bool {
  1734  		replaced[index] = replacer(index, val)
  1735  		return true
  1736  	})
  1737  	return &Value{data: replaced}
  1738  }
  1739  
  1740  // CollectUintptr uses the specified collector function to collect a value
  1741  // for each of the uintptrs in the slice.  The data returned will be a
  1742  // []interface{}.
  1743  func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value {
  1744  	arr := v.MustUintptrSlice()
  1745  	collected := make([]interface{}, len(arr))
  1746  	v.EachUintptr(func(index int, val uintptr) bool {
  1747  		collected[index] = collector(index, val)
  1748  		return true
  1749  	})
  1750  	return &Value{data: collected}
  1751  }
  1752  
  1753  /*
  1754     Float32 (float32 and []float32)
  1755  */
  1756  
  1757  // Float32 gets the value as a float32, returns the optionalDefault
  1758  // value or a system default object if the value is the wrong type.
  1759  func (v *Value) Float32(optionalDefault ...float32) float32 {
  1760  	if s, ok := v.data.(float32); ok {
  1761  		return s
  1762  	}
  1763  	if len(optionalDefault) == 1 {
  1764  		return optionalDefault[0]
  1765  	}
  1766  	return 0
  1767  }
  1768  
  1769  // MustFloat32 gets the value as a float32.
  1770  //
  1771  // Panics if the object is not a float32.
  1772  func (v *Value) MustFloat32() float32 {
  1773  	return v.data.(float32)
  1774  }
  1775  
  1776  // Float32Slice gets the value as a []float32, returns the optionalDefault
  1777  // value or nil if the value is not a []float32.
  1778  func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 {
  1779  	if s, ok := v.data.([]float32); ok {
  1780  		return s
  1781  	}
  1782  	if len(optionalDefault) == 1 {
  1783  		return optionalDefault[0]
  1784  	}
  1785  	return nil
  1786  }
  1787  
  1788  // MustFloat32Slice gets the value as a []float32.
  1789  //
  1790  // Panics if the object is not a []float32.
  1791  func (v *Value) MustFloat32Slice() []float32 {
  1792  	return v.data.([]float32)
  1793  }
  1794  
  1795  // IsFloat32 gets whether the object contained is a float32 or not.
  1796  func (v *Value) IsFloat32() bool {
  1797  	_, ok := v.data.(float32)
  1798  	return ok
  1799  }
  1800  
  1801  // IsFloat32Slice gets whether the object contained is a []float32 or not.
  1802  func (v *Value) IsFloat32Slice() bool {
  1803  	_, ok := v.data.([]float32)
  1804  	return ok
  1805  }
  1806  
  1807  // EachFloat32 calls the specified callback for each object
  1808  // in the []float32.
  1809  //
  1810  // Panics if the object is the wrong type.
  1811  func (v *Value) EachFloat32(callback func(int, float32) bool) *Value {
  1812  	for index, val := range v.MustFloat32Slice() {
  1813  		carryon := callback(index, val)
  1814  		if !carryon {
  1815  			break
  1816  		}
  1817  	}
  1818  	return v
  1819  }
  1820  
  1821  // WhereFloat32 uses the specified decider function to select items
  1822  // from the []float32.  The object contained in the result will contain
  1823  // only the selected items.
  1824  func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value {
  1825  	var selected []float32
  1826  	v.EachFloat32(func(index int, val float32) bool {
  1827  		shouldSelect := decider(index, val)
  1828  		if !shouldSelect {
  1829  			selected = append(selected, val)
  1830  		}
  1831  		return true
  1832  	})
  1833  	return &Value{data: selected}
  1834  }
  1835  
  1836  // GroupFloat32 uses the specified grouper function to group the items
  1837  // keyed by the return of the grouper.  The object contained in the
  1838  // result will contain a map[string][]float32.
  1839  func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value {
  1840  	groups := make(map[string][]float32)
  1841  	v.EachFloat32(func(index int, val float32) bool {
  1842  		group := grouper(index, val)
  1843  		if _, ok := groups[group]; !ok {
  1844  			groups[group] = make([]float32, 0)
  1845  		}
  1846  		groups[group] = append(groups[group], val)
  1847  		return true
  1848  	})
  1849  	return &Value{data: groups}
  1850  }
  1851  
  1852  // ReplaceFloat32 uses the specified function to replace each float32s
  1853  // by iterating each item.  The data in the returned result will be a
  1854  // []float32 containing the replaced items.
  1855  func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value {
  1856  	arr := v.MustFloat32Slice()
  1857  	replaced := make([]float32, len(arr))
  1858  	v.EachFloat32(func(index int, val float32) bool {
  1859  		replaced[index] = replacer(index, val)
  1860  		return true
  1861  	})
  1862  	return &Value{data: replaced}
  1863  }
  1864  
  1865  // CollectFloat32 uses the specified collector function to collect a value
  1866  // for each of the float32s in the slice.  The data returned will be a
  1867  // []interface{}.
  1868  func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value {
  1869  	arr := v.MustFloat32Slice()
  1870  	collected := make([]interface{}, len(arr))
  1871  	v.EachFloat32(func(index int, val float32) bool {
  1872  		collected[index] = collector(index, val)
  1873  		return true
  1874  	})
  1875  	return &Value{data: collected}
  1876  }
  1877  
  1878  /*
  1879     Float64 (float64 and []float64)
  1880  */
  1881  
  1882  // Float64 gets the value as a float64, returns the optionalDefault
  1883  // value or a system default object if the value is the wrong type.
  1884  func (v *Value) Float64(optionalDefault ...float64) float64 {
  1885  	if s, ok := v.data.(float64); ok {
  1886  		return s
  1887  	}
  1888  	if len(optionalDefault) == 1 {
  1889  		return optionalDefault[0]
  1890  	}
  1891  	return 0
  1892  }
  1893  
  1894  // MustFloat64 gets the value as a float64.
  1895  //
  1896  // Panics if the object is not a float64.
  1897  func (v *Value) MustFloat64() float64 {
  1898  	return v.data.(float64)
  1899  }
  1900  
  1901  // Float64Slice gets the value as a []float64, returns the optionalDefault
  1902  // value or nil if the value is not a []float64.
  1903  func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 {
  1904  	if s, ok := v.data.([]float64); ok {
  1905  		return s
  1906  	}
  1907  	if len(optionalDefault) == 1 {
  1908  		return optionalDefault[0]
  1909  	}
  1910  	return nil
  1911  }
  1912  
  1913  // MustFloat64Slice gets the value as a []float64.
  1914  //
  1915  // Panics if the object is not a []float64.
  1916  func (v *Value) MustFloat64Slice() []float64 {
  1917  	return v.data.([]float64)
  1918  }
  1919  
  1920  // IsFloat64 gets whether the object contained is a float64 or not.
  1921  func (v *Value) IsFloat64() bool {
  1922  	_, ok := v.data.(float64)
  1923  	return ok
  1924  }
  1925  
  1926  // IsFloat64Slice gets whether the object contained is a []float64 or not.
  1927  func (v *Value) IsFloat64Slice() bool {
  1928  	_, ok := v.data.([]float64)
  1929  	return ok
  1930  }
  1931  
  1932  // EachFloat64 calls the specified callback for each object
  1933  // in the []float64.
  1934  //
  1935  // Panics if the object is the wrong type.
  1936  func (v *Value) EachFloat64(callback func(int, float64) bool) *Value {
  1937  	for index, val := range v.MustFloat64Slice() {
  1938  		carryon := callback(index, val)
  1939  		if !carryon {
  1940  			break
  1941  		}
  1942  	}
  1943  	return v
  1944  }
  1945  
  1946  // WhereFloat64 uses the specified decider function to select items
  1947  // from the []float64.  The object contained in the result will contain
  1948  // only the selected items.
  1949  func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value {
  1950  	var selected []float64
  1951  	v.EachFloat64(func(index int, val float64) bool {
  1952  		shouldSelect := decider(index, val)
  1953  		if !shouldSelect {
  1954  			selected = append(selected, val)
  1955  		}
  1956  		return true
  1957  	})
  1958  	return &Value{data: selected}
  1959  }
  1960  
  1961  // GroupFloat64 uses the specified grouper function to group the items
  1962  // keyed by the return of the grouper.  The object contained in the
  1963  // result will contain a map[string][]float64.
  1964  func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value {
  1965  	groups := make(map[string][]float64)
  1966  	v.EachFloat64(func(index int, val float64) bool {
  1967  		group := grouper(index, val)
  1968  		if _, ok := groups[group]; !ok {
  1969  			groups[group] = make([]float64, 0)
  1970  		}
  1971  		groups[group] = append(groups[group], val)
  1972  		return true
  1973  	})
  1974  	return &Value{data: groups}
  1975  }
  1976  
  1977  // ReplaceFloat64 uses the specified function to replace each float64s
  1978  // by iterating each item.  The data in the returned result will be a
  1979  // []float64 containing the replaced items.
  1980  func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value {
  1981  	arr := v.MustFloat64Slice()
  1982  	replaced := make([]float64, len(arr))
  1983  	v.EachFloat64(func(index int, val float64) bool {
  1984  		replaced[index] = replacer(index, val)
  1985  		return true
  1986  	})
  1987  	return &Value{data: replaced}
  1988  }
  1989  
  1990  // CollectFloat64 uses the specified collector function to collect a value
  1991  // for each of the float64s in the slice.  The data returned will be a
  1992  // []interface{}.
  1993  func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value {
  1994  	arr := v.MustFloat64Slice()
  1995  	collected := make([]interface{}, len(arr))
  1996  	v.EachFloat64(func(index int, val float64) bool {
  1997  		collected[index] = collector(index, val)
  1998  		return true
  1999  	})
  2000  	return &Value{data: collected}
  2001  }
  2002  
  2003  /*
  2004     Complex64 (complex64 and []complex64)
  2005  */
  2006  
  2007  // Complex64 gets the value as a complex64, returns the optionalDefault
  2008  // value or a system default object if the value is the wrong type.
  2009  func (v *Value) Complex64(optionalDefault ...complex64) complex64 {
  2010  	if s, ok := v.data.(complex64); ok {
  2011  		return s
  2012  	}
  2013  	if len(optionalDefault) == 1 {
  2014  		return optionalDefault[0]
  2015  	}
  2016  	return 0
  2017  }
  2018  
  2019  // MustComplex64 gets the value as a complex64.
  2020  //
  2021  // Panics if the object is not a complex64.
  2022  func (v *Value) MustComplex64() complex64 {
  2023  	return v.data.(complex64)
  2024  }
  2025  
  2026  // Complex64Slice gets the value as a []complex64, returns the optionalDefault
  2027  // value or nil if the value is not a []complex64.
  2028  func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 {
  2029  	if s, ok := v.data.([]complex64); ok {
  2030  		return s
  2031  	}
  2032  	if len(optionalDefault) == 1 {
  2033  		return optionalDefault[0]
  2034  	}
  2035  	return nil
  2036  }
  2037  
  2038  // MustComplex64Slice gets the value as a []complex64.
  2039  //
  2040  // Panics if the object is not a []complex64.
  2041  func (v *Value) MustComplex64Slice() []complex64 {
  2042  	return v.data.([]complex64)
  2043  }
  2044  
  2045  // IsComplex64 gets whether the object contained is a complex64 or not.
  2046  func (v *Value) IsComplex64() bool {
  2047  	_, ok := v.data.(complex64)
  2048  	return ok
  2049  }
  2050  
  2051  // IsComplex64Slice gets whether the object contained is a []complex64 or not.
  2052  func (v *Value) IsComplex64Slice() bool {
  2053  	_, ok := v.data.([]complex64)
  2054  	return ok
  2055  }
  2056  
  2057  // EachComplex64 calls the specified callback for each object
  2058  // in the []complex64.
  2059  //
  2060  // Panics if the object is the wrong type.
  2061  func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value {
  2062  	for index, val := range v.MustComplex64Slice() {
  2063  		carryon := callback(index, val)
  2064  		if !carryon {
  2065  			break
  2066  		}
  2067  	}
  2068  	return v
  2069  }
  2070  
  2071  // WhereComplex64 uses the specified decider function to select items
  2072  // from the []complex64.  The object contained in the result will contain
  2073  // only the selected items.
  2074  func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value {
  2075  	var selected []complex64
  2076  	v.EachComplex64(func(index int, val complex64) bool {
  2077  		shouldSelect := decider(index, val)
  2078  		if !shouldSelect {
  2079  			selected = append(selected, val)
  2080  		}
  2081  		return true
  2082  	})
  2083  	return &Value{data: selected}
  2084  }
  2085  
  2086  // GroupComplex64 uses the specified grouper function to group the items
  2087  // keyed by the return of the grouper.  The object contained in the
  2088  // result will contain a map[string][]complex64.
  2089  func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value {
  2090  	groups := make(map[string][]complex64)
  2091  	v.EachComplex64(func(index int, val complex64) bool {
  2092  		group := grouper(index, val)
  2093  		if _, ok := groups[group]; !ok {
  2094  			groups[group] = make([]complex64, 0)
  2095  		}
  2096  		groups[group] = append(groups[group], val)
  2097  		return true
  2098  	})
  2099  	return &Value{data: groups}
  2100  }
  2101  
  2102  // ReplaceComplex64 uses the specified function to replace each complex64s
  2103  // by iterating each item.  The data in the returned result will be a
  2104  // []complex64 containing the replaced items.
  2105  func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value {
  2106  	arr := v.MustComplex64Slice()
  2107  	replaced := make([]complex64, len(arr))
  2108  	v.EachComplex64(func(index int, val complex64) bool {
  2109  		replaced[index] = replacer(index, val)
  2110  		return true
  2111  	})
  2112  	return &Value{data: replaced}
  2113  }
  2114  
  2115  // CollectComplex64 uses the specified collector function to collect a value
  2116  // for each of the complex64s in the slice.  The data returned will be a
  2117  // []interface{}.
  2118  func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value {
  2119  	arr := v.MustComplex64Slice()
  2120  	collected := make([]interface{}, len(arr))
  2121  	v.EachComplex64(func(index int, val complex64) bool {
  2122  		collected[index] = collector(index, val)
  2123  		return true
  2124  	})
  2125  	return &Value{data: collected}
  2126  }
  2127  
  2128  /*
  2129     Complex128 (complex128 and []complex128)
  2130  */
  2131  
  2132  // Complex128 gets the value as a complex128, returns the optionalDefault
  2133  // value or a system default object if the value is the wrong type.
  2134  func (v *Value) Complex128(optionalDefault ...complex128) complex128 {
  2135  	if s, ok := v.data.(complex128); ok {
  2136  		return s
  2137  	}
  2138  	if len(optionalDefault) == 1 {
  2139  		return optionalDefault[0]
  2140  	}
  2141  	return 0
  2142  }
  2143  
  2144  // MustComplex128 gets the value as a complex128.
  2145  //
  2146  // Panics if the object is not a complex128.
  2147  func (v *Value) MustComplex128() complex128 {
  2148  	return v.data.(complex128)
  2149  }
  2150  
  2151  // Complex128Slice gets the value as a []complex128, returns the optionalDefault
  2152  // value or nil if the value is not a []complex128.
  2153  func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 {
  2154  	if s, ok := v.data.([]complex128); ok {
  2155  		return s
  2156  	}
  2157  	if len(optionalDefault) == 1 {
  2158  		return optionalDefault[0]
  2159  	}
  2160  	return nil
  2161  }
  2162  
  2163  // MustComplex128Slice gets the value as a []complex128.
  2164  //
  2165  // Panics if the object is not a []complex128.
  2166  func (v *Value) MustComplex128Slice() []complex128 {
  2167  	return v.data.([]complex128)
  2168  }
  2169  
  2170  // IsComplex128 gets whether the object contained is a complex128 or not.
  2171  func (v *Value) IsComplex128() bool {
  2172  	_, ok := v.data.(complex128)
  2173  	return ok
  2174  }
  2175  
  2176  // IsComplex128Slice gets whether the object contained is a []complex128 or not.
  2177  func (v *Value) IsComplex128Slice() bool {
  2178  	_, ok := v.data.([]complex128)
  2179  	return ok
  2180  }
  2181  
  2182  // EachComplex128 calls the specified callback for each object
  2183  // in the []complex128.
  2184  //
  2185  // Panics if the object is the wrong type.
  2186  func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value {
  2187  	for index, val := range v.MustComplex128Slice() {
  2188  		carryon := callback(index, val)
  2189  		if !carryon {
  2190  			break
  2191  		}
  2192  	}
  2193  	return v
  2194  }
  2195  
  2196  // WhereComplex128 uses the specified decider function to select items
  2197  // from the []complex128.  The object contained in the result will contain
  2198  // only the selected items.
  2199  func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value {
  2200  	var selected []complex128
  2201  	v.EachComplex128(func(index int, val complex128) bool {
  2202  		shouldSelect := decider(index, val)
  2203  		if !shouldSelect {
  2204  			selected = append(selected, val)
  2205  		}
  2206  		return true
  2207  	})
  2208  	return &Value{data: selected}
  2209  }
  2210  
  2211  // GroupComplex128 uses the specified grouper function to group the items
  2212  // keyed by the return of the grouper.  The object contained in the
  2213  // result will contain a map[string][]complex128.
  2214  func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value {
  2215  	groups := make(map[string][]complex128)
  2216  	v.EachComplex128(func(index int, val complex128) bool {
  2217  		group := grouper(index, val)
  2218  		if _, ok := groups[group]; !ok {
  2219  			groups[group] = make([]complex128, 0)
  2220  		}
  2221  		groups[group] = append(groups[group], val)
  2222  		return true
  2223  	})
  2224  	return &Value{data: groups}
  2225  }
  2226  
  2227  // ReplaceComplex128 uses the specified function to replace each complex128s
  2228  // by iterating each item.  The data in the returned result will be a
  2229  // []complex128 containing the replaced items.
  2230  func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value {
  2231  	arr := v.MustComplex128Slice()
  2232  	replaced := make([]complex128, len(arr))
  2233  	v.EachComplex128(func(index int, val complex128) bool {
  2234  		replaced[index] = replacer(index, val)
  2235  		return true
  2236  	})
  2237  	return &Value{data: replaced}
  2238  }
  2239  
  2240  // CollectComplex128 uses the specified collector function to collect a value
  2241  // for each of the complex128s in the slice.  The data returned will be a
  2242  // []interface{}.
  2243  func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value {
  2244  	arr := v.MustComplex128Slice()
  2245  	collected := make([]interface{}, len(arr))
  2246  	v.EachComplex128(func(index int, val complex128) bool {
  2247  		collected[index] = collector(index, val)
  2248  		return true
  2249  	})
  2250  	return &Value{data: collected}
  2251  }