Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnsupportedTypeConversion = errors.New("unsupported type conversion")
)
Functions ¶
func FromInterfaceTo ¶ added in v1.2.0
FromInterfaceTo converts data from type interface{} to any type given. The used switch case shows which type conversions are supported. If the type is not supported, ErrUnsupportedTypeConversion is thrown.
func ToPointer ¶
func ToPointer[E any](toConvert E) *E
ToPointer converts any type (E) to pointer (*E)
func ToPointerOrNil ¶
func ToPointerOrNil[T constraints.Ordered](toConvert T) *T
ToPointerOrNil converts like ToPointer but returns nil if toConvert is a zero value.
func ToValue ¶
func ToValue[E any](toConvert *E) E
ToValue converts any pointer (*E) to value (E). Panics if toConvert is a nil pointer.
func ToValueOrZero ¶
func ToValueOrZero[T constraints.Ordered](toConvert *T) T
ToValueOrZero converts like ToValue but returns a zero value if toConvert is nil.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.