 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func From[T any](input *T) (output T)
- func FromBool(input bool) *bool
- func FromEnum[T ~string](input *T) (output string)
- func FromFloat64(input float64) *float64
- func FromInt(input int) *int
- func FromInt64(input int64) *int64
- func FromMapOfStringInterfaces(input map[string]interface{}) *map[string]interface{}
- func FromMapOfStringStrings(input map[string]string) *map[string]string
- func FromSliceOfStrings(input []string) *[]string
- func FromString(input string) *string
- func To[T any](input T) *T
- func ToBool(input *bool) bool
- func ToEnum[T ~string](input string) *T
- func ToFloat64(input *float64) float64
- func ToInt(input *int) int
- func ToInt64(input *int64) int64
- func ToMapOfStringInterfaces(input *map[string]interface{}) map[string]interface{}
- func ToMapOfStringStrings(input *map[string]string) map[string]string
- func ToSliceOfStrings(input *[]string) []string
- func ToString(input *string) string
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 FromEnum ¶ added in v0.71.1
FromEnum is a helper function to return a string from a pointer to an Enum without having to cast it example code simplification: myStruct.SomeStringValue = string(pointer.From(model.EnumValue)) becomes myStruct.SomeStringValue = pointer.FromEnum(model.EnumValue) if input is nil, returns an empty string
func FromFloat64 ¶ added in v0.18.0
FromFloat64 turns a float64 into a pointer to a float64
func FromMapOfStringInterfaces ¶ added in v0.18.0
FromMapOfStringInterfaces turns a map[string]interface{} into a pointer to a map[string]interface{}
func FromMapOfStringStrings ¶ added in v0.18.0
FromMapOfStringStrings turns a map[string]string into a pointer to a map[string]string
func FromSliceOfStrings ¶ added in v0.18.0
FromSliceOfStrings turns a slice of stirngs into a pointer to a slice of strings
func FromString ¶ added in v0.18.0
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 ¶
ToBool turns a pointer to a bool into a bool, returning the default value for a bool if it's nil
func ToEnum ¶ added in v0.71.1
ToEnum is a helper function to cast strings as an Enum type where API objects expect a pointer to the Enum value example code simplification: APIModel.SomeValue = pointer.To(someservice.SomeEnumType(model.SomeVariable)) becomes APIModel.SomeValue = pointer.ToEnum[someservice.SomeEnumType](model.SomeVariable)
func ToFloat64 ¶ added in v0.18.0
ToFloat64 turns a pointer to a float64 into a float64, returning the default value for a float64 if it's nil
func ToInt ¶
ToInt turns a pointer to an int into an int, returning the default value for an int if it's nil
func ToInt64 ¶
ToInt64 turns a pointer to an int64 into an int64, returning the default value for an int64 if it's nil
func ToMapOfStringInterfaces ¶
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 ¶
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 ¶
ToSliceOfStrings turns a pointer to a slice of strings into a slice of strings returning an empty slice of strings if it's nil
Types ¶
This section is empty.