typeconv

package
v0.0.0-...-a0cf6f9 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsAnyMap

func AsAnyMap[T any, K comparable](m map[K]T) map[K]any

AsAnyMap converts map[K]T into map[K]any

func AsAnyMapCoercingNils

func AsAnyMapCoercingNils[T any, K comparable](m map[K]T) map[K]any

AsAnyMapCoercingNils converts map[K]T into map[K]any, coercing typed nils into non-typed nils

func AsAnySlice

func AsAnySlice[T any](slice []T) []any

AsAnySlice converts []T into []any

func AsAnySliceCoercingNils

func AsAnySliceCoercingNils[T any](slice []T) []any

AsAnySliceCoercingNils converts []T into []any, coercing typed nils into non-typed nils

func AsBool

func AsBool[T comparable](v T) bool

AsBool converts T to bool

func AtoiRef

func AtoiRef(v *string) (*int, error)

AtoiRef converts *string into *int

func BoolRefToNullBool

func BoolRefToNullBool(p *bool) sql.NullBool

func BoolTo

func BoolTo[T constraints.Integer](v bool) T

BoolTo converts bool to int

func ByteRefToNullByte

func ByteRefToNullByte(p *byte) sql.NullByte

func CoerceIntMap

func CoerceIntMap[TReturn constraints.Integer, TArg constraints.Integer, K comparable](m map[K]TArg) map[K]TReturn

CoerceIntMap interconverts map[T]int types of arbitrary precision

func CoerceIntRef

func CoerceIntRef[TReturn constraints.Integer, TArg constraints.Integer](v *TArg) *TReturn

CoerceIntRef interconverts *int types of arbitrary precision

func CoerceIntSlice

func CoerceIntSlice[TReturn constraints.Integer, TArg constraints.Integer](slice []TArg) []TReturn

CoerceIntSlice interconverts []int types of arbitrary precision

func Float64RefToNullFloat64

func Float64RefToNullFloat64(p *float64) sql.NullFloat64

func IndirectOr

func IndirectOr[T any](v *T, defaultValue T) T

IndirectOr unwraps a pointer value, falling back to default.

func Int16RefToNullInt16

func Int16RefToNullInt16(p *int16) sql.NullInt16

func Int32RefToNullInt32

func Int32RefToNullInt32(p *int32) sql.NullInt32

func Int64RefToNullInt64

func Int64RefToNullInt64(p *int64) sql.NullInt64

func ItoaRef

func ItoaRef(v *int) *string

ItoaRef converts *int into *string

func NullBoolToBoolRef

func NullBoolToBoolRef(v sql.NullBool) *bool

func NullByteToByteRef

func NullByteToByteRef(v sql.NullByte) *byte

func NullFloat64ToFloat64Ref

func NullFloat64ToFloat64Ref(v sql.NullFloat64) *float64

func NullInt16ToInt16Ref

func NullInt16ToInt16Ref(v sql.NullInt16) *int16

func NullInt32ToInt32Ref

func NullInt32ToInt32Ref(v sql.NullInt32) *int32

func NullInt64ToInt64Ref

func NullInt64ToInt64Ref(v sql.NullInt64) *int64

func NullStringToStringRef

func NullStringToStringRef(v sql.NullString) *string

func NullTimeToTimeRef

func NullTimeToTimeRef(v sql.NullTime) *time.Time

func Ref

func Ref[T any](v T) *T

Ref returns a pointer to the passed value

func StringRefToNullString

func StringRefToNullString(p *string) sql.NullString

func TimeRefToNullTime

func TimeRefToNullTime(p *time.Time) sql.NullTime

Types

This section is empty.

Jump to

Keyboard shortcuts

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