github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/util/helper.go (about)

     1  package util
     2  
     3  // Bool is a helper routine that allocates a new bool value
     4  // to store v and returns a pointer to it.
     5  func Bool(v bool) *bool {
     6  	return &v
     7  }
     8  
     9  // Int is a helper routine that allocates a new int value
    10  // to store v and returns a pointer to it.
    11  func Int(v int) *int {
    12  	return &v
    13  }
    14  
    15  // Int32 is a helper routine that allocates a new int32 value
    16  // to store v and returns a pointer to it.
    17  func Int32(v int32) *int32 {
    18  	return &v
    19  }
    20  
    21  // Int64 is a helper routine that allocates a new int64 value
    22  // to store v and returns a pointer to it.
    23  func Int64(v int64) *int64 {
    24  	return &v
    25  }
    26  
    27  // Float32 is a helper routine that allocates a new float32 value
    28  // to store v and returns a pointer to it.
    29  func Float32(v float32) *float32 {
    30  	return &v
    31  }
    32  
    33  // Float64 is a helper routine that allocates a new float64 value
    34  // to store v and returns a pointer to it.
    35  func Float64(v float64) *float64 {
    36  	return &v
    37  }
    38  
    39  // Uint32 is a helper routine that allocates a new uint32 value
    40  // to store v and returns a pointer to it.
    41  func Uint32(v uint32) *uint32 {
    42  	return &v
    43  }
    44  
    45  // Uint64 is a helper routine that allocates a new uint64 value
    46  // to store v and returns a pointer to it.
    47  func Uint64(v uint64) *uint64 {
    48  	return &v
    49  }
    50  
    51  // String is a helper routine that allocates a new string value
    52  // to store v and returns a pointer to it.
    53  func String(v string) *string {
    54  	return &v
    55  }