helpers.go raw

   1  package btcjson
   2  
   3  // Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it. This is useful when
   4  // assigning optional parameters.
   5  func Bool(v bool) *bool {
   6  	p := new(bool)
   7  	*p = v
   8  	return p
   9  }
  10  
  11  // Int is a helper routine that allocates a new int value to store v and returns a pointer to it. This is useful when
  12  // assigning optional parameters.
  13  func Int(v int) *int {
  14  	p := new(int)
  15  	*p = v
  16  	return p
  17  }
  18  
  19  // Uint is a helper routine that allocates a new uint value to store v and returns a pointer to it. This is useful when
  20  // assigning optional parameters.
  21  func Uint(v uint) *uint {
  22  	p := new(uint)
  23  	*p = v
  24  	return p
  25  }
  26  
  27  // Int32 is a helper routine that allocates a new int32 value to store v and returns a pointer to it. This is useful
  28  // when assigning optional parameters.
  29  func Int32(v int32) *int32 {
  30  	p := new(int32)
  31  	*p = v
  32  	return p
  33  }
  34  
  35  // Uint32 is a helper routine that allocates a new uint32 value to store v and returns a pointer to it. This is useful
  36  // when assigning optional parameters.
  37  func Uint32(v uint32) *uint32 {
  38  	p := new(uint32)
  39  	*p = v
  40  	return p
  41  }
  42  
  43  // Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it. This is useful
  44  // when assigning optional parameters.
  45  func Int64(v int64) *int64 {
  46  	p := new(int64)
  47  	*p = v
  48  	return p
  49  }
  50  
  51  // Uint64 is a helper routine that allocates a new uint64 value to store v and returns a pointer to it. This is useful
  52  // when assigning optional parameters.
  53  func Uint64(v uint64) *uint64 {
  54  	p := new(uint64)
  55  	*p = v
  56  	return p
  57  }
  58  
  59  // Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it. This is useful
  60  // when assigning optional parameters.
  61  func Float64(v float64) *float64 {
  62  	p := new(float64)
  63  	*p = v
  64  	return p
  65  }
  66  
  67  // String is a helper routine that allocates a new string value to store v and returns a pointer to it. This is useful
  68  // when assigning optional parameters.
  69  func String(v string) *string {
  70  	p := new(string)
  71  	*p = v
  72  	return p
  73  }
  74