pointer

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MPL-2.0 Imports: 0 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func From added in v0.42.0

func From[T any](input *T) (output T)

From is a generic function that returns the value of a pointer If the pointer is nil, a zero value for the underlying type of the pointer is returned.

func FromBool added in v0.18.0

func FromBool(input bool) *bool

FromBool turns a boolean into a pointer to a boolean

func FromFloat64 added in v0.18.0

func FromFloat64(input float64) *float64

FromFloat64 turns a float64 into a pointer to a float64

func FromInt added in v0.18.0

func FromInt(input int) *int

FromInt turns a int into a pointer to a int

func FromInt64 added in v0.18.0

func FromInt64(input int64) *int64

FromInt64 turns a int64 into a pointer to a int64

func FromMapOfStringInterfaces added in v0.18.0

func FromMapOfStringInterfaces(input map[string]interface{}) *map[string]interface{}

FromMapOfStringInterfaces turns a map[string]interface{} into a pointer to a map[string]interface{}

func FromMapOfStringStrings added in v0.18.0

func FromMapOfStringStrings(input map[string]string) *map[string]string

FromMapOfStringStrings turns a map[string]string into a pointer to a map[string]string

func FromSliceOfStrings added in v0.18.0

func FromSliceOfStrings(input []string) *[]string

FromSliceOfStrings turns a slice of stirngs into a pointer to a slice of strings

func FromString added in v0.18.0

func FromString(input string) *string

FromString turns a string into a pointer to a string

func To added in v0.42.0

func To[T any](input T) *T

To is a generic function that returns a pointer to the value provided.

func ToBool

func ToBool(input *bool) bool

ToBool turns a pointer to a bool into a bool, returning the default value for a bool if it's nil

func ToFloat64 added in v0.18.0

func ToFloat64(input *float64) float64

ToFloat64 turns a pointer to a float64 into a float64, returning the default value for a float64 if it's nil

func ToInt

func ToInt(input *int) int

ToInt turns a pointer to an int into an int, returning the default value for an int if it's nil

func ToInt64

func ToInt64(input *int64) int64

ToInt64 turns a pointer to an int64 into an int64, returning the default value for an int64 if it's nil

func ToMapOfStringInterfaces

func ToMapOfStringInterfaces(input *map[string]interface{}) map[string]interface{}

ToMapOfStringInterfaces turns a pointer to a map[string]interface{} into a map[string]interface{} returning an empty map[string]interface{} if it's nil

func ToMapOfStringStrings

func ToMapOfStringStrings(input *map[string]string) map[string]string

ToMapOfStringStrings turns a pointer to a map[string]string into a map[string]string returning an empty map[string]string if it's nil

func ToSliceOfStrings

func ToSliceOfStrings(input *[]string) []string

ToSliceOfStrings turns a pointer to a slice of strings into a slice of strings returning an empty slice of strings if it's nil

func ToString

func ToString(input *string) string

ToString turns a pointer to a string into a string, returning an empty string if it's nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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