pointer

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 1 Imported by: 2

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBool

func ToBool(b bool) *bool

ToBool returns a pointer to the passed bool value.

func ToBoolOrNil

func ToBoolOrNil(b bool) *bool

ToBoolOrNil returns a pointer to the passed bool value, or nil, if passed value is a zero value.

func ToByte

func ToByte(b byte) *byte

ToByte returns a pointer to the passed byte value.

func ToByteOrNil

func ToByteOrNil(b byte) *byte

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

func ToComplex64(c complex64) *complex64

ToComplex64 returns a pointer to the passed complex64 value.

func ToComplex64OrNil

func ToComplex64OrNil(c complex64) *complex64

ToComplex64OrNil returns a pointer to the passed complex64 value, or nil, if passed value is a zero value.

func ToDuration

func ToDuration(d time.Duration) *time.Duration

ToDuration returns a pointer to the passed time.Duration value.

func ToDurationOrNil

func ToDurationOrNil(d time.Duration) *time.Duration

ToDurationOrNil returns a pointer to the passed time.Duration value, or nil, if passed value is a zero value.

func ToError

func ToError(e error) *error

ToError returns a pointer to the passed error value.

func ToErrorOrNil

func ToErrorOrNil(e error) *error

ToErrorOrNil returns a pointer to the passed error value, or nil, if passed value is a zero value.

func ToFloat32

func ToFloat32(f float32) *float32

ToFloat32 returns a pointer to the passed float32 value.

func ToFloat32OrNil

func ToFloat32OrNil(f float32) *float32

ToFloat32OrNil returns a pointer to the passed float32 value, or nil, if passed value is a zero value.

func ToFloat64

func ToFloat64(f float64) *float64

ToFloat64 returns a pointer to the passed float64 value.

func ToFloat64OrNil

func ToFloat64OrNil(f float64) *float64

ToFloat64OrNil returns a pointer to the passed float64 value, or nil, if passed value is a zero value.

func ToInt

func ToInt(i int) *int

ToInt returns a pointer to the passed int value.

func ToInt16

func ToInt16(i int16) *int16

ToInt16 returns a pointer to the passed int16 value.

func ToInt16OrNil

func ToInt16OrNil(i int16) *int16

ToInt16OrNil returns a pointer to the passed int16 value, or nil, if passed value is a zero value.

func ToInt32

func ToInt32(i int32) *int32

ToInt32 returns a pointer to the passed int32 value.

func ToInt32OrNil

func ToInt32OrNil(i int32) *int32

ToInt32OrNil returns a pointer to the passed int32 value, or nil, if passed value is a zero value.

func ToInt64

func ToInt64(i int64) *int64

ToInt64 returns a pointer to the passed int64 value.

func ToInt64OrNil

func ToInt64OrNil(i int64) *int64

ToInt64OrNil returns a pointer to the passed int64 value, or nil, if passed value is a zero value.

func ToInt8

func ToInt8(i int8) *int8

ToInt8 returns a pointer to the passed int8 value.

func ToInt8OrNil

func ToInt8OrNil(i int8) *int8

ToInt8OrNil returns a pointer to the passed int8 value, or nil, if passed value is a zero value.

func ToIntOrNil

func ToIntOrNil(i int) *int

ToIntOrNil returns a pointer to the passed int value, or nil, if passed value is a zero value.

func ToRune

func ToRune(r rune) *rune

ToRune returns a pointer to the passed rune value.

func ToRuneOrNil

func ToRuneOrNil(r rune) *rune

ToRuneOrNil returns a pointer to the passed rune value, or nil, if passed value is a zero value.

func ToString

func ToString(s string) *string

ToString returns a pointer to the passed string value.

func ToStringOrNil

func ToStringOrNil(s string) *string

ToStringOrNil returns a pointer to the passed string value, or nil, if passed value is a zero value.

func ToTime

func ToTime(t time.Time) *time.Time

ToTime returns a pointer to the passed time.Time value.

func ToTimeOrNil

func ToTimeOrNil(t time.Time) *time.Time

ToTimeOrNil returns a pointer to the passed time.Time value, or nil, if passed value is a zero value (t.IsZero() returns true).

func ToUint

func ToUint(u uint) *uint

ToUint returns a pointer to the passed uint value.

func ToUint16

func ToUint16(u uint16) *uint16

ToUint16 returns a pointer to the passed uint16 value.

func ToUint16OrNil

func ToUint16OrNil(u uint16) *uint16

ToUint16OrNil returns a pointer to the passed uint16 value, or nil, if passed value is a zero value.

func ToUint32

func ToUint32(u uint32) *uint32

ToUint32 returns a pointer to the passed uint32 value.

func ToUint32OrNil

func ToUint32OrNil(u uint32) *uint32

ToUint32OrNil returns a pointer to the passed uint32 value, or nil, if passed value is a zero value.

func ToUint64

func ToUint64(u uint64) *uint64

ToUint64 returns a pointer to the passed uint64 value.

func ToUint64OrNil

func ToUint64OrNil(u uint64) *uint64

ToUint64OrNil returns a pointer to the passed uint64 value, or nil, if passed value is a zero value.

func ToUint8

func ToUint8(u uint8) *uint8

ToUint8 returns a pointer to the passed uint8 value.

func ToUint8OrNil

func ToUint8OrNil(u uint8) *uint8

ToUint8OrNil returns a pointer to the passed uint8 value, or nil, if passed value is a zero value.

func ToUintOrNil

func ToUintOrNil(u uint) *uint

ToUintOrNil returns a pointer to the passed uint value, or nil, if passed value is a zero value.

func ToUintptr

func ToUintptr(u uintptr) *uintptr

ToUintptr returns a pointer to the passed uintptr value.

func ToUintptrOrNil

func ToUintptrOrNil(u uintptr) *uintptr

ToUintptrOrNil returns a pointer to the passed uintptr value, or nil, if passed value is a zero value.

func ValueOfBool

func ValueOfBool(b *bool) bool

ValueOfBool returns the value of the bool pointer passed in or false if the pointer is nil.

func ValueOfByte

func ValueOfByte(b *byte) byte

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

func ValueOfComplex64(c *complex64) complex64

ValueOfComplex64 returns the value of the complex64 pointer passed in or 0 if the pointer is nil.

func ValueOfDuration

func ValueOfDuration(d *time.Duration) time.Duration

ValueOfDuration returns the value of the duration pointer passed in or 0 if the pointer is nil.

func ValueOfError

func ValueOfError(e *error) error

ValueOfError returns the value of the error pointer passed in or nil if the pointer is nil.

func ValueOfFloat32

func ValueOfFloat32(f *float32) float32

ValueOfFloat32 returns the value of the float32 pointer passed in or 0 if the pointer is nil.

func ValueOfFloat64

func ValueOfFloat64(f *float64) float64

ValueOfFloat64 returns the value of the float64 pointer passed in or 0 if the pointer is nil.

func ValueOfInt

func ValueOfInt(i *int) int

ValueOfInt returns the value of the int pointer passed in or 0 if the pointer is nil.

func ValueOfInt16

func ValueOfInt16(i *int16) int16

ValueOfInt16 returns the value of the int16 pointer passed in or 0 if the pointer is nil.

func ValueOfInt32

func ValueOfInt32(i *int32) int32

ValueOfInt32 returns the value of the int32 pointer passed in or 0 if the pointer is nil.

func ValueOfInt64

func ValueOfInt64(i *int64) int64

ValueOfInt64 returns the value of the int64 pointer passed in or 0 if the pointer is nil.

func ValueOfInt8

func ValueOfInt8(i *int8) int8

ValueOfInt8 returns the value of the int8 pointer passed in or 0 if the pointer is nil.

func ValueOfRune

func ValueOfRune(r *rune) rune

ValueOfRune returns the value of the rune pointer passed in or 0 if the pointer is nil.

func ValueOfString

func ValueOfString(s *string) string

ValueOfString returns the value of the string pointer passed in or empty string if the pointer is nil.

func ValueOfTime

func ValueOfTime(t *time.Time) time.Time

ValueOfTime returns the value of the time pointer passed in or zero time.Time if the pointer is nil.

func ValueOfUint

func ValueOfUint(u *uint) uint

ValueOfUint returns the value of the uint pointer passed in or 0 if the pointer is nil.

func ValueOfUint16

func ValueOfUint16(u *uint16) uint16

ValueOfUint16 returns the value of the uint16 pointer passed in or 0 if the pointer is nil.

func ValueOfUint32

func ValueOfUint32(u *uint32) uint32

ValueOfUint32 returns the value of the uint32 pointer passed in or 0 if the pointer is nil.

func ValueOfUint64

func ValueOfUint64(u *uint64) uint64

ValueOfUint64 returns the value of the uint64 pointer passed in or 0 if the pointer is nil.

func ValueOfUint8

func ValueOfUint8(u *uint8) uint8

ValueOfUint8 returns the value of the uint8 pointer passed in or 0 if the pointer is nil.

func ValueOfUintptr

func ValueOfUintptr(u *uintptr) uintptr

ValueOfUintptr returns the value of the uintptr pointer passed in or 0 if the pointer is nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL