github.com/wangyougui/gf/v2@v2.6.5/util/gconv/gconv_ptr.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/wangyougui/gf.
     6  
     7  package gconv
     8  
     9  // PtrAny creates and returns an interface{} pointer variable to this value.
    10  func PtrAny(any interface{}) *interface{} {
    11  	return &any
    12  }
    13  
    14  // PtrString creates and returns a string pointer variable to this value.
    15  func PtrString(any interface{}) *string {
    16  	v := String(any)
    17  	return &v
    18  }
    19  
    20  // PtrBool creates and returns a bool pointer variable to this value.
    21  func PtrBool(any interface{}) *bool {
    22  	v := Bool(any)
    23  	return &v
    24  }
    25  
    26  // PtrInt creates and returns an int pointer variable to this value.
    27  func PtrInt(any interface{}) *int {
    28  	v := Int(any)
    29  	return &v
    30  }
    31  
    32  // PtrInt8 creates and returns an int8 pointer variable to this value.
    33  func PtrInt8(any interface{}) *int8 {
    34  	v := Int8(any)
    35  	return &v
    36  }
    37  
    38  // PtrInt16 creates and returns an int16 pointer variable to this value.
    39  func PtrInt16(any interface{}) *int16 {
    40  	v := Int16(any)
    41  	return &v
    42  }
    43  
    44  // PtrInt32 creates and returns an int32 pointer variable to this value.
    45  func PtrInt32(any interface{}) *int32 {
    46  	v := Int32(any)
    47  	return &v
    48  }
    49  
    50  // PtrInt64 creates and returns an int64 pointer variable to this value.
    51  func PtrInt64(any interface{}) *int64 {
    52  	v := Int64(any)
    53  	return &v
    54  }
    55  
    56  // PtrUint creates and returns an uint pointer variable to this value.
    57  func PtrUint(any interface{}) *uint {
    58  	v := Uint(any)
    59  	return &v
    60  }
    61  
    62  // PtrUint8 creates and returns an uint8 pointer variable to this value.
    63  func PtrUint8(any interface{}) *uint8 {
    64  	v := Uint8(any)
    65  	return &v
    66  }
    67  
    68  // PtrUint16 creates and returns an uint16 pointer variable to this value.
    69  func PtrUint16(any interface{}) *uint16 {
    70  	v := Uint16(any)
    71  	return &v
    72  }
    73  
    74  // PtrUint32 creates and returns an uint32 pointer variable to this value.
    75  func PtrUint32(any interface{}) *uint32 {
    76  	v := Uint32(any)
    77  	return &v
    78  }
    79  
    80  // PtrUint64 creates and returns an uint64 pointer variable to this value.
    81  func PtrUint64(any interface{}) *uint64 {
    82  	v := Uint64(any)
    83  	return &v
    84  }
    85  
    86  // PtrFloat32 creates and returns a float32 pointer variable to this value.
    87  func PtrFloat32(any interface{}) *float32 {
    88  	v := Float32(any)
    89  	return &v
    90  }
    91  
    92  // PtrFloat64 creates and returns a float64 pointer variable to this value.
    93  func PtrFloat64(any interface{}) *float64 {
    94  	v := Float64(any)
    95  	return &v
    96  }