Documentation
¶
Overview ¶
Package pointer provides helpers to get pointers to values of built-in primitives.
Based on https://github.com/AlekSi/pointer. Synced at https://github.com/AlekSi/pointer/compare/4f2b1f4deff73a28288291183baa1e9dff4a93a5...master. Original license: https://github.com/AlekSi/pointer/blob/master/LICENSE.
Index ¶
- func ToBool(b bool) *bool
- func ToBoolOrNil(b bool) *bool
- func ToByte(b byte) *byte
- func ToByteOrNil(b byte) *byte
- func ToComplex128(c complex128) *complex128
- func ToComplex128OrNil(c complex128) *complex128
- func ToComplex64(c complex64) *complex64
- func ToComplex64OrNil(c complex64) *complex64
- func ToDuration(d time.Duration) *time.Duration
- func ToDurationOrNil(d time.Duration) *time.Duration
- func ToError(e error) *error
- func ToErrorOrNil(e error) *error
- func ToFloat32(f float32) *float32
- func ToFloat32OrNil(f float32) *float32
- func ToFloat64(f float64) *float64
- func ToFloat64OrNil(f float64) *float64
- func ToInt(i int) *int
- func ToInt16(i int16) *int16
- func ToInt16OrNil(i int16) *int16
- func ToInt32(i int32) *int32
- func ToInt32OrNil(i int32) *int32
- func ToInt64(i int64) *int64
- func ToInt64OrNil(i int64) *int64
- func ToInt8(i int8) *int8
- func ToInt8OrNil(i int8) *int8
- func ToIntOrNil(i int) *int
- func ToRune(r rune) *rune
- func ToRuneOrNil(r rune) *rune
- func ToString(s string) *string
- func ToStringOrNil(s string) *string
- func ToTime(t time.Time) *time.Time
- func ToTimeOrNil(t time.Time) *time.Time
- func ToUint(u uint) *uint
- func ToUint16(u uint16) *uint16
- func ToUint16OrNil(u uint16) *uint16
- func ToUint32(u uint32) *uint32
- func ToUint32OrNil(u uint32) *uint32
- func ToUint64(u uint64) *uint64
- func ToUint64OrNil(u uint64) *uint64
- func ToUint8(u uint8) *uint8
- func ToUint8OrNil(u uint8) *uint8
- func ToUintOrNil(u uint) *uint
- func ToUintptr(u uintptr) *uintptr
- func ToUintptrOrNil(u uintptr) *uintptr
- func ValueOfBool(b *bool) bool
- func ValueOfByte(b *byte) byte
- func ValueOfComplex128(c *complex128) complex128
- func ValueOfComplex64(c *complex64) complex64
- func ValueOfDuration(d *time.Duration) time.Duration
- func ValueOfError(e *error) error
- func ValueOfFloat32(f *float32) float32
- func ValueOfFloat64(f *float64) float64
- func ValueOfInt(i *int) int
- func ValueOfInt16(i *int16) int16
- func ValueOfInt32(i *int32) int32
- func ValueOfInt64(i *int64) int64
- func ValueOfInt8(i *int8) int8
- func ValueOfRune(r *rune) rune
- func ValueOfString(s *string) string
- func ValueOfTime(t *time.Time) time.Time
- func ValueOfUint(u *uint) uint
- func ValueOfUint16(u *uint16) uint16
- func ValueOfUint32(u *uint32) uint32
- func ValueOfUint64(u *uint64) uint64
- func ValueOfUint8(u *uint8) uint8
- func ValueOfUintptr(u *uintptr) uintptr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToBoolOrNil ¶
ToBoolOrNil returns a pointer to the passed bool value, or nil, if passed value is a zero value.
func ToByteOrNil ¶
ToByteOrNil returns a pointer to the passed byte value, or nil, if passed value is a zero value.
func ToComplex128 ¶
func ToComplex128(c complex128) *complex128
ToComplex128 returns a pointer to the passed complex128 value.
func ToComplex128OrNil ¶
func ToComplex128OrNil(c complex128) *complex128
ToComplex128OrNil returns a pointer to the passed complex128 value, or nil, if passed value is a zero value.
func ToComplex64 ¶
ToComplex64 returns a pointer to the passed complex64 value.
func ToComplex64OrNil ¶
ToComplex64OrNil returns a pointer to the passed complex64 value, or nil, if passed value is a zero value.
func ToDuration ¶
ToDuration returns a pointer to the passed time.Duration value.
func ToDurationOrNil ¶
ToDurationOrNil returns a pointer to the passed time.Duration value, or nil, if passed value is a zero value.
func ToErrorOrNil ¶
ToErrorOrNil returns a pointer to the passed error value, or nil, if passed value is a zero value.
func ToFloat32OrNil ¶
ToFloat32OrNil returns a pointer to the passed float32 value, or nil, if passed value is a zero value.
func ToFloat64OrNil ¶
ToFloat64OrNil returns a pointer to the passed float64 value, or nil, if passed value is a zero value.
func ToInt16OrNil ¶
ToInt16OrNil returns a pointer to the passed int16 value, or nil, if passed value is a zero value.
func ToInt32OrNil ¶
ToInt32OrNil returns a pointer to the passed int32 value, or nil, if passed value is a zero value.
func ToInt64OrNil ¶
ToInt64OrNil returns a pointer to the passed int64 value, or nil, if passed value is a zero value.
func ToInt8OrNil ¶
ToInt8OrNil returns a pointer to the passed int8 value, or nil, if passed value is a zero value.
func ToIntOrNil ¶
ToIntOrNil returns a pointer to the passed int value, or nil, if passed value is a zero value.
func ToRuneOrNil ¶
ToRuneOrNil returns a pointer to the passed rune value, or nil, if passed value is a zero value.
func ToStringOrNil ¶
ToStringOrNil returns a pointer to the passed string value, or nil, if passed value is a zero value.
func ToTimeOrNil ¶
ToTimeOrNil returns a pointer to the passed time.Time value, or nil, if passed value is a zero value (t.IsZero() returns true).
func ToUint16OrNil ¶
ToUint16OrNil returns a pointer to the passed uint16 value, or nil, if passed value is a zero value.
func ToUint32OrNil ¶
ToUint32OrNil returns a pointer to the passed uint32 value, or nil, if passed value is a zero value.
func ToUint64OrNil ¶
ToUint64OrNil returns a pointer to the passed uint64 value, or nil, if passed value is a zero value.
func ToUint8OrNil ¶
ToUint8OrNil returns a pointer to the passed uint8 value, or nil, if passed value is a zero value.
func ToUintOrNil ¶
ToUintOrNil returns a pointer to the passed uint value, or nil, if passed value is a zero value.
func ToUintptrOrNil ¶
ToUintptrOrNil returns a pointer to the passed uintptr value, or nil, if passed value is a zero value.
func ValueOfBool ¶
ValueOfBool returns the value of the bool pointer passed in or false if the pointer is nil.
func ValueOfByte ¶
ValueOfByte returns the value of the byte pointer passed in or 0 if the pointer is nil.
func ValueOfComplex128 ¶
func ValueOfComplex128(c *complex128) complex128
ValueOfComplex128 returns the value of the complex128 pointer passed in or 0 if the pointer is nil.
func ValueOfComplex64 ¶
ValueOfComplex64 returns the value of the complex64 pointer passed in or 0 if the pointer is nil.
func ValueOfDuration ¶
ValueOfDuration returns the value of the duration pointer passed in or 0 if the pointer is nil.
func ValueOfError ¶
ValueOfError returns the value of the error pointer passed in or nil if the pointer is nil.
func ValueOfFloat32 ¶
ValueOfFloat32 returns the value of the float32 pointer passed in or 0 if the pointer is nil.
func ValueOfFloat64 ¶
ValueOfFloat64 returns the value of the float64 pointer passed in or 0 if the pointer is nil.
func ValueOfInt ¶
ValueOfInt returns the value of the int pointer passed in or 0 if the pointer is nil.
func ValueOfInt16 ¶
ValueOfInt16 returns the value of the int16 pointer passed in or 0 if the pointer is nil.
func ValueOfInt32 ¶
ValueOfInt32 returns the value of the int32 pointer passed in or 0 if the pointer is nil.
func ValueOfInt64 ¶
ValueOfInt64 returns the value of the int64 pointer passed in or 0 if the pointer is nil.
func ValueOfInt8 ¶
ValueOfInt8 returns the value of the int8 pointer passed in or 0 if the pointer is nil.
func ValueOfRune ¶
ValueOfRune returns the value of the rune pointer passed in or 0 if the pointer is nil.
func ValueOfString ¶
ValueOfString returns the value of the string pointer passed in or empty string if the pointer is nil.
func ValueOfTime ¶
ValueOfTime returns the value of the time pointer passed in or zero time.Time if the pointer is nil.
func ValueOfUint ¶
ValueOfUint returns the value of the uint pointer passed in or 0 if the pointer is nil.
func ValueOfUint16 ¶
ValueOfUint16 returns the value of the uint16 pointer passed in or 0 if the pointer is nil.
func ValueOfUint32 ¶
ValueOfUint32 returns the value of the uint32 pointer passed in or 0 if the pointer is nil.
func ValueOfUint64 ¶
ValueOfUint64 returns the value of the uint64 pointer passed in or 0 if the pointer is nil.
func ValueOfUint8 ¶
ValueOfUint8 returns the value of the uint8 pointer passed in or 0 if the pointer is nil.
func ValueOfUintptr ¶
ValueOfUintptr returns the value of the uintptr pointer passed in or 0 if the pointer is nil.
Types ¶
This section is empty.