...

Source file src/github.com/aws/smithy-go/ptr/to_ptr.go

Documentation: github.com/aws/smithy-go/ptr

     1  // Code generated by smithy-go/ptr/generate.go DO NOT EDIT.
     2  package ptr
     3  
     4  import (
     5  	"time"
     6  )
     7  
     8  // Bool returns a pointer value for the bool value passed in.
     9  func Bool(v bool) *bool {
    10  	return &v
    11  }
    12  
    13  // BoolSlice returns a slice of bool pointers from the values
    14  // passed in.
    15  func BoolSlice(vs []bool) []*bool {
    16  	ps := make([]*bool, len(vs))
    17  	for i, v := range vs {
    18  		vv := v
    19  		ps[i] = &vv
    20  	}
    21  
    22  	return ps
    23  }
    24  
    25  // BoolMap returns a map of bool pointers from the values
    26  // passed in.
    27  func BoolMap(vs map[string]bool) map[string]*bool {
    28  	ps := make(map[string]*bool, len(vs))
    29  	for k, v := range vs {
    30  		vv := v
    31  		ps[k] = &vv
    32  	}
    33  
    34  	return ps
    35  }
    36  
    37  // Byte returns a pointer value for the byte value passed in.
    38  func Byte(v byte) *byte {
    39  	return &v
    40  }
    41  
    42  // ByteSlice returns a slice of byte pointers from the values
    43  // passed in.
    44  func ByteSlice(vs []byte) []*byte {
    45  	ps := make([]*byte, len(vs))
    46  	for i, v := range vs {
    47  		vv := v
    48  		ps[i] = &vv
    49  	}
    50  
    51  	return ps
    52  }
    53  
    54  // ByteMap returns a map of byte pointers from the values
    55  // passed in.
    56  func ByteMap(vs map[string]byte) map[string]*byte {
    57  	ps := make(map[string]*byte, len(vs))
    58  	for k, v := range vs {
    59  		vv := v
    60  		ps[k] = &vv
    61  	}
    62  
    63  	return ps
    64  }
    65  
    66  // String returns a pointer value for the string value passed in.
    67  func String(v string) *string {
    68  	return &v
    69  }
    70  
    71  // StringSlice returns a slice of string pointers from the values
    72  // passed in.
    73  func StringSlice(vs []string) []*string {
    74  	ps := make([]*string, len(vs))
    75  	for i, v := range vs {
    76  		vv := v
    77  		ps[i] = &vv
    78  	}
    79  
    80  	return ps
    81  }
    82  
    83  // StringMap returns a map of string pointers from the values
    84  // passed in.
    85  func StringMap(vs map[string]string) map[string]*string {
    86  	ps := make(map[string]*string, len(vs))
    87  	for k, v := range vs {
    88  		vv := v
    89  		ps[k] = &vv
    90  	}
    91  
    92  	return ps
    93  }
    94  
    95  // Int returns a pointer value for the int value passed in.
    96  func Int(v int) *int {
    97  	return &v
    98  }
    99  
   100  // IntSlice returns a slice of int pointers from the values
   101  // passed in.
   102  func IntSlice(vs []int) []*int {
   103  	ps := make([]*int, len(vs))
   104  	for i, v := range vs {
   105  		vv := v
   106  		ps[i] = &vv
   107  	}
   108  
   109  	return ps
   110  }
   111  
   112  // IntMap returns a map of int pointers from the values
   113  // passed in.
   114  func IntMap(vs map[string]int) map[string]*int {
   115  	ps := make(map[string]*int, len(vs))
   116  	for k, v := range vs {
   117  		vv := v
   118  		ps[k] = &vv
   119  	}
   120  
   121  	return ps
   122  }
   123  
   124  // Int8 returns a pointer value for the int8 value passed in.
   125  func Int8(v int8) *int8 {
   126  	return &v
   127  }
   128  
   129  // Int8Slice returns a slice of int8 pointers from the values
   130  // passed in.
   131  func Int8Slice(vs []int8) []*int8 {
   132  	ps := make([]*int8, len(vs))
   133  	for i, v := range vs {
   134  		vv := v
   135  		ps[i] = &vv
   136  	}
   137  
   138  	return ps
   139  }
   140  
   141  // Int8Map returns a map of int8 pointers from the values
   142  // passed in.
   143  func Int8Map(vs map[string]int8) map[string]*int8 {
   144  	ps := make(map[string]*int8, len(vs))
   145  	for k, v := range vs {
   146  		vv := v
   147  		ps[k] = &vv
   148  	}
   149  
   150  	return ps
   151  }
   152  
   153  // Int16 returns a pointer value for the int16 value passed in.
   154  func Int16(v int16) *int16 {
   155  	return &v
   156  }
   157  
   158  // Int16Slice returns a slice of int16 pointers from the values
   159  // passed in.
   160  func Int16Slice(vs []int16) []*int16 {
   161  	ps := make([]*int16, len(vs))
   162  	for i, v := range vs {
   163  		vv := v
   164  		ps[i] = &vv
   165  	}
   166  
   167  	return ps
   168  }
   169  
   170  // Int16Map returns a map of int16 pointers from the values
   171  // passed in.
   172  func Int16Map(vs map[string]int16) map[string]*int16 {
   173  	ps := make(map[string]*int16, len(vs))
   174  	for k, v := range vs {
   175  		vv := v
   176  		ps[k] = &vv
   177  	}
   178  
   179  	return ps
   180  }
   181  
   182  // Int32 returns a pointer value for the int32 value passed in.
   183  func Int32(v int32) *int32 {
   184  	return &v
   185  }
   186  
   187  // Int32Slice returns a slice of int32 pointers from the values
   188  // passed in.
   189  func Int32Slice(vs []int32) []*int32 {
   190  	ps := make([]*int32, len(vs))
   191  	for i, v := range vs {
   192  		vv := v
   193  		ps[i] = &vv
   194  	}
   195  
   196  	return ps
   197  }
   198  
   199  // Int32Map returns a map of int32 pointers from the values
   200  // passed in.
   201  func Int32Map(vs map[string]int32) map[string]*int32 {
   202  	ps := make(map[string]*int32, len(vs))
   203  	for k, v := range vs {
   204  		vv := v
   205  		ps[k] = &vv
   206  	}
   207  
   208  	return ps
   209  }
   210  
   211  // Int64 returns a pointer value for the int64 value passed in.
   212  func Int64(v int64) *int64 {
   213  	return &v
   214  }
   215  
   216  // Int64Slice returns a slice of int64 pointers from the values
   217  // passed in.
   218  func Int64Slice(vs []int64) []*int64 {
   219  	ps := make([]*int64, len(vs))
   220  	for i, v := range vs {
   221  		vv := v
   222  		ps[i] = &vv
   223  	}
   224  
   225  	return ps
   226  }
   227  
   228  // Int64Map returns a map of int64 pointers from the values
   229  // passed in.
   230  func Int64Map(vs map[string]int64) map[string]*int64 {
   231  	ps := make(map[string]*int64, len(vs))
   232  	for k, v := range vs {
   233  		vv := v
   234  		ps[k] = &vv
   235  	}
   236  
   237  	return ps
   238  }
   239  
   240  // Uint returns a pointer value for the uint value passed in.
   241  func Uint(v uint) *uint {
   242  	return &v
   243  }
   244  
   245  // UintSlice returns a slice of uint pointers from the values
   246  // passed in.
   247  func UintSlice(vs []uint) []*uint {
   248  	ps := make([]*uint, len(vs))
   249  	for i, v := range vs {
   250  		vv := v
   251  		ps[i] = &vv
   252  	}
   253  
   254  	return ps
   255  }
   256  
   257  // UintMap returns a map of uint pointers from the values
   258  // passed in.
   259  func UintMap(vs map[string]uint) map[string]*uint {
   260  	ps := make(map[string]*uint, len(vs))
   261  	for k, v := range vs {
   262  		vv := v
   263  		ps[k] = &vv
   264  	}
   265  
   266  	return ps
   267  }
   268  
   269  // Uint8 returns a pointer value for the uint8 value passed in.
   270  func Uint8(v uint8) *uint8 {
   271  	return &v
   272  }
   273  
   274  // Uint8Slice returns a slice of uint8 pointers from the values
   275  // passed in.
   276  func Uint8Slice(vs []uint8) []*uint8 {
   277  	ps := make([]*uint8, len(vs))
   278  	for i, v := range vs {
   279  		vv := v
   280  		ps[i] = &vv
   281  	}
   282  
   283  	return ps
   284  }
   285  
   286  // Uint8Map returns a map of uint8 pointers from the values
   287  // passed in.
   288  func Uint8Map(vs map[string]uint8) map[string]*uint8 {
   289  	ps := make(map[string]*uint8, len(vs))
   290  	for k, v := range vs {
   291  		vv := v
   292  		ps[k] = &vv
   293  	}
   294  
   295  	return ps
   296  }
   297  
   298  // Uint16 returns a pointer value for the uint16 value passed in.
   299  func Uint16(v uint16) *uint16 {
   300  	return &v
   301  }
   302  
   303  // Uint16Slice returns a slice of uint16 pointers from the values
   304  // passed in.
   305  func Uint16Slice(vs []uint16) []*uint16 {
   306  	ps := make([]*uint16, len(vs))
   307  	for i, v := range vs {
   308  		vv := v
   309  		ps[i] = &vv
   310  	}
   311  
   312  	return ps
   313  }
   314  
   315  // Uint16Map returns a map of uint16 pointers from the values
   316  // passed in.
   317  func Uint16Map(vs map[string]uint16) map[string]*uint16 {
   318  	ps := make(map[string]*uint16, len(vs))
   319  	for k, v := range vs {
   320  		vv := v
   321  		ps[k] = &vv
   322  	}
   323  
   324  	return ps
   325  }
   326  
   327  // Uint32 returns a pointer value for the uint32 value passed in.
   328  func Uint32(v uint32) *uint32 {
   329  	return &v
   330  }
   331  
   332  // Uint32Slice returns a slice of uint32 pointers from the values
   333  // passed in.
   334  func Uint32Slice(vs []uint32) []*uint32 {
   335  	ps := make([]*uint32, len(vs))
   336  	for i, v := range vs {
   337  		vv := v
   338  		ps[i] = &vv
   339  	}
   340  
   341  	return ps
   342  }
   343  
   344  // Uint32Map returns a map of uint32 pointers from the values
   345  // passed in.
   346  func Uint32Map(vs map[string]uint32) map[string]*uint32 {
   347  	ps := make(map[string]*uint32, len(vs))
   348  	for k, v := range vs {
   349  		vv := v
   350  		ps[k] = &vv
   351  	}
   352  
   353  	return ps
   354  }
   355  
   356  // Uint64 returns a pointer value for the uint64 value passed in.
   357  func Uint64(v uint64) *uint64 {
   358  	return &v
   359  }
   360  
   361  // Uint64Slice returns a slice of uint64 pointers from the values
   362  // passed in.
   363  func Uint64Slice(vs []uint64) []*uint64 {
   364  	ps := make([]*uint64, len(vs))
   365  	for i, v := range vs {
   366  		vv := v
   367  		ps[i] = &vv
   368  	}
   369  
   370  	return ps
   371  }
   372  
   373  // Uint64Map returns a map of uint64 pointers from the values
   374  // passed in.
   375  func Uint64Map(vs map[string]uint64) map[string]*uint64 {
   376  	ps := make(map[string]*uint64, len(vs))
   377  	for k, v := range vs {
   378  		vv := v
   379  		ps[k] = &vv
   380  	}
   381  
   382  	return ps
   383  }
   384  
   385  // Float32 returns a pointer value for the float32 value passed in.
   386  func Float32(v float32) *float32 {
   387  	return &v
   388  }
   389  
   390  // Float32Slice returns a slice of float32 pointers from the values
   391  // passed in.
   392  func Float32Slice(vs []float32) []*float32 {
   393  	ps := make([]*float32, len(vs))
   394  	for i, v := range vs {
   395  		vv := v
   396  		ps[i] = &vv
   397  	}
   398  
   399  	return ps
   400  }
   401  
   402  // Float32Map returns a map of float32 pointers from the values
   403  // passed in.
   404  func Float32Map(vs map[string]float32) map[string]*float32 {
   405  	ps := make(map[string]*float32, len(vs))
   406  	for k, v := range vs {
   407  		vv := v
   408  		ps[k] = &vv
   409  	}
   410  
   411  	return ps
   412  }
   413  
   414  // Float64 returns a pointer value for the float64 value passed in.
   415  func Float64(v float64) *float64 {
   416  	return &v
   417  }
   418  
   419  // Float64Slice returns a slice of float64 pointers from the values
   420  // passed in.
   421  func Float64Slice(vs []float64) []*float64 {
   422  	ps := make([]*float64, len(vs))
   423  	for i, v := range vs {
   424  		vv := v
   425  		ps[i] = &vv
   426  	}
   427  
   428  	return ps
   429  }
   430  
   431  // Float64Map returns a map of float64 pointers from the values
   432  // passed in.
   433  func Float64Map(vs map[string]float64) map[string]*float64 {
   434  	ps := make(map[string]*float64, len(vs))
   435  	for k, v := range vs {
   436  		vv := v
   437  		ps[k] = &vv
   438  	}
   439  
   440  	return ps
   441  }
   442  
   443  // Time returns a pointer value for the time.Time value passed in.
   444  func Time(v time.Time) *time.Time {
   445  	return &v
   446  }
   447  
   448  // TimeSlice returns a slice of time.Time pointers from the values
   449  // passed in.
   450  func TimeSlice(vs []time.Time) []*time.Time {
   451  	ps := make([]*time.Time, len(vs))
   452  	for i, v := range vs {
   453  		vv := v
   454  		ps[i] = &vv
   455  	}
   456  
   457  	return ps
   458  }
   459  
   460  // TimeMap returns a map of time.Time pointers from the values
   461  // passed in.
   462  func TimeMap(vs map[string]time.Time) map[string]*time.Time {
   463  	ps := make(map[string]*time.Time, len(vs))
   464  	for k, v := range vs {
   465  		vv := v
   466  		ps[k] = &vv
   467  	}
   468  
   469  	return ps
   470  }
   471  
   472  // Duration returns a pointer value for the time.Duration value passed in.
   473  func Duration(v time.Duration) *time.Duration {
   474  	return &v
   475  }
   476  
   477  // DurationSlice returns a slice of time.Duration pointers from the values
   478  // passed in.
   479  func DurationSlice(vs []time.Duration) []*time.Duration {
   480  	ps := make([]*time.Duration, len(vs))
   481  	for i, v := range vs {
   482  		vv := v
   483  		ps[i] = &vv
   484  	}
   485  
   486  	return ps
   487  }
   488  
   489  // DurationMap returns a map of time.Duration pointers from the values
   490  // passed in.
   491  func DurationMap(vs map[string]time.Duration) map[string]*time.Duration {
   492  	ps := make(map[string]*time.Duration, len(vs))
   493  	for k, v := range vs {
   494  		vv := v
   495  		ps[k] = &vv
   496  	}
   497  
   498  	return ps
   499  }
   500  

View as plain text