Documentation ¶
Overview ¶
Package pointer provides helpers to get pointers to values of built-in types.
Index ¶
- func ToBool(in bool) *bool
- func ToByte(in byte) *byte
- func ToComplex128(in complex128) *complex128
- func ToComplex64(in complex64) *complex64
- func ToDuration(in time.Duration) *time.Duration
- func ToFloat32(in float32) *float32
- func ToFloat64(in float64) *float64
- func ToInt(in int) *int
- func ToInt16(in int16) *int16
- func ToInt32(in int32) *int32
- func ToInt64(in int64) *int64
- func ToInt8(in int8) *int8
- func ToRune(in rune) *rune
- func ToString(in string) *string
- func ToTime(in time.Time) *time.Time
- func ToUint(in uint) *uint
- func ToUint16(in uint16) *uint16
- func ToUint32(in uint32) *uint32
- func ToUint64(in uint64) *uint64
- func ToUint8(in uint8) *uint8
- func ToUintptr(in uintptr) *uintptr
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToComplex128 ¶
func ToComplex128(in complex128) *complex128
ToComplex128 gets pointer to complex 128.
func ToDuration ¶
ToDuration get pointer by time.Duration.
Example ¶
package main import ( "fmt" "time" "gitoa.ru/go-4devs/pointer" ) func main() { fmt.Printf("%T, %T", pointer.ToDuration(time.Hour), time.Hour) }
Output: *time.Duration, time.Duration
func ToInt64 ¶
ToInt64 gets pointer int64.
Example ¶
package main import ( "fmt" "gitoa.ru/go-4devs/pointer" ) func main() { fmt.Printf("%T", pointer.ToInt64(1)) }
Output: *int64
func ToString ¶
ToString gets pointer string.
Example ¶
package main import ( "fmt" "gitoa.ru/go-4devs/pointer" ) func main() { fmt.Printf("%T, %T", pointer.ToString("message"), "message") }
Output: *string, string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.