cast

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayOf

func ArrayOf[T any, R any](fn func(v T) (R, bool)) func(v interface{}) ([]R, bool)

func AsNullable

func AsNullable[T any, R any](fn func(v T) (R, bool)) func(v Nullable[T]) (Nullable[R], bool)

func CanCast

func CanCast(from, to DataColumnType) bool

func CastBlobToAny

func CastBlobToAny[T ~[]byte](v T) (interface{}, bool)

func CastBlobToString

func CastBlobToString[T ~[]byte, R ~string](v T) (R, bool)

func CastBoolToAny

func CastBoolToAny[T ~bool](v T) (interface{}, bool)

func CastBoolToBool

func CastBoolToBool[T ~bool, R ~bool](v T) (R, bool)

func CastBoolToNumber

func CastBoolToNumber[T ~bool, R Int | Uint | Float | Complex](v T) (R, bool)

func CastBoolToString

func CastBoolToString[T ~bool, R ~string](v T) (R, bool)

func CastComplexToAny

func CastComplexToAny[T Complex](v T) (interface{}, bool)

func CastComplexToBool

func CastComplexToBool[T Complex, R ~bool](v T) (R, bool)

func CastComplexToComplex

func CastComplexToComplex[T Complex, R Complex](v T) (R, bool)

func CastComplexToNumber

func CastComplexToNumber[T Complex, R Int | Uint | Float](v T) (R, bool)

func CastComplexToString

func CastComplexToString[T Complex, R ~string](v T) (R, bool)

func CastComplexToTime

func CastComplexToTime[T Complex](v T) (time.Time, bool)

func CastComplexToTimeRange

func CastComplexToTimeRange[T Complex](v T) (TimeRange, bool)

func CastFloatToBool

func CastFloatToBool[T Float, R ~bool](v T) (R, bool)

func CastFloatToString

func CastFloatToString[T Float, R ~string](v T) (R, bool)

func CastFloatToTime

func CastFloatToTime[T Float](v T) (time.Time, bool)

func CastFloatToTimeRange

func CastFloatToTimeRange[T Float](v T) (TimeRange, bool)

func CastFuncOf

func CastFuncOf[R any](fn func(v interface{}) (R, bool)) CastFunc

func CastIntToString

func CastIntToString[T Int, R ~string](v T) (R, bool)

func CastIntegerToBool

func CastIntegerToBool[T Int | Uint, R ~bool](v T) (R, bool)

func CastIntegerToTime

func CastIntegerToTime[T Int | Uint](v T) (time.Time, bool)

func CastIntegerToTimeRange

func CastIntegerToTimeRange[T Int | Uint](v T) (TimeRange, bool)

func CastNumberToAny

func CastNumberToAny[T Int | Uint | Float](v T) (interface{}, bool)

func CastNumberToComplex

func CastNumberToComplex[T Int | Uint | Float, R Complex](v T) (R, bool)

func CastNumberToNumber

func CastNumberToNumber[T Int | Uint | Float, R Int | Uint | Float](v T) (R, bool)

func CastStringToAny

func CastStringToAny[T ~string](v T) (interface{}, bool)

func CastStringToBool

func CastStringToBool[T ~string, R ~bool](v T) (R, bool)

func CastStringToComplex

func CastStringToComplex[T ~string, R Complex](v T) (R, bool)

func CastStringToFloat

func CastStringToFloat[T ~string, R Float](v T) (R, bool)

func CastStringToInt

func CastStringToInt[T ~string, R Int](v T) (R, bool)

func CastStringToString

func CastStringToString[T ~string, R ~string](v T) (R, bool)

func CastStringToTime

func CastStringToTime[T ~string](v T) (time.Time, bool)

func CastStringToTimeRange

func CastStringToTimeRange[T ~string](v T) (TimeRange, bool)

func CastStringToUint

func CastStringToUint[T ~string, R Uint](v T) (R, bool)

func CastTimeRangeToAny

func CastTimeRangeToAny(v TimeRange) (interface{}, bool)

func CastTimeRangeToComplex

func CastTimeRangeToComplex[R Complex](v TimeRange) (R, bool)

func CastTimeRangeToNumber

func CastTimeRangeToNumber[R Int | Uint | Float](v TimeRange) (R, bool)

func CastTimeRangeToString

func CastTimeRangeToString[R ~string](v TimeRange) (R, bool)

func CastTimeRangeToTime

func CastTimeRangeToTime(v TimeRange) (time.Time, bool)

func CastTimeRangeToTimeRange

func CastTimeRangeToTimeRange(v TimeRange) (TimeRange, bool)

func CastTimeToAny

func CastTimeToAny(v time.Time) (interface{}, bool)

func CastTimeToComplex

func CastTimeToComplex[R Complex](v time.Time) (R, bool)

func CastTimeToNumber

func CastTimeToNumber[R Int | Uint | Float](v time.Time) (R, bool)

func CastTimeToString

func CastTimeToString[R ~string](v time.Time) (R, bool)

func CastTimeToTime

func CastTimeToTime(v time.Time) (time.Time, bool)

func CastTimeToTimeRange

func CastTimeToTimeRange(v time.Time) (TimeRange, bool)

func CastToItself

func CastToItself[T any](v interface{}) (ret interface{}, ok bool)

func CastUintToString

func CastUintToString[T Uint, R ~string](v T) (R, bool)

func Combine

func Combine(funcs ...CastFunc) CastFunc

func Fail

func Fail(v interface{}) (ret interface{}, ok bool)

func FailR

func FailR[R any](v interface{}) (ret R, ok bool)

func FailTR

func FailTR[T, R any](v T) (ret R, ok bool)

func GenerateCastFunc

func GenerateCastFunc[T any, R any](from, to DataColumnType, fn func(v T) (R, bool)) CastFunc

func GetArithmeticPromotedType

func GetArithmeticPromotedType(a, b DataColumnType) (DataColumnType, DataColumnType)

For `<`, `<=`, `>`, `>=` and arithmetic operators

func GetCastFunc

func GetCastFunc(from, to DataColumnType) CastFunc

func GetComparingPromotedType

func GetComparingPromotedType(a, b DataColumnType) (DataColumnType, DataColumnType)

For `==`, `!=`

func GetConcatPromotedType

func GetConcatPromotedType(a, b DataColumnType) (DataColumnType, DataColumnType)

func GetInRangePromotedType

func GetInRangePromotedType(a, b DataColumnType) (DataColumnType, DataColumnType)

func GetType

func GetType(rt reflect.Type) DataColumnType

func NewArrayCastFunc

func NewArrayCastFunc[T any, R any](fn func(v T) (R, bool)) CastFunc

func NewCastFunc

func NewCastFunc[T any, R any](fn func(v T) (R, bool)) CastFunc

func NewRawArrayCastFunc

func NewRawArrayCastFunc[T any, R any](fn func(v T) (R, bool)) func(v interface{}) ([]R, bool)

func NewRawCastFunc

func NewRawCastFunc[T any, R any](fn func(v T) (R, bool)) func(v interface{}) (R, bool)

func RawCastToItself

func RawCastToItself[T any](v interface{}) (ret T, ok bool)

func ToAny

func ToAny(v interface{}) (interface{}, bool)

func ToBlob

func ToBlob[R ~[]byte](v interface{}) (R, bool)

func ToBool

func ToBool[R ~bool](v interface{}) (R, bool)

func ToComplex

func ToComplex[R Complex](v interface{}) (R, bool)

func ToFloat

func ToFloat[R Float](v interface{}) (R, bool)

func ToInt

func ToInt[R Int](v interface{}) (R, bool)

func ToNullableAny

func ToNullableAny(v interface{}) (Nullable[interface{}], bool)

func ToNullableBlob

func ToNullableBlob[R ~[]byte](v interface{}) (Nullable[R], bool)

func ToNullableBool

func ToNullableBool[R ~bool](v interface{}) (Nullable[R], bool)

func ToNullableComplex

func ToNullableComplex[R Complex](v interface{}) (Nullable[R], bool)

func ToNullableFloat

func ToNullableFloat[R Float](v interface{}) (Nullable[R], bool)

func ToNullableInt

func ToNullableInt[R Int](v interface{}) (Nullable[R], bool)

func ToNullableString

func ToNullableString[R ~string](v interface{}) (Nullable[R], bool)

func ToNullableTime

func ToNullableTime(v interface{}) (Nullable[time.Time], bool)

func ToNullableTimeRange

func ToNullableTimeRange(v interface{}) (Nullable[TimeRange], bool)

func ToNullableUint

func ToNullableUint[R Uint](v interface{}) (Nullable[R], bool)

func ToString

func ToString[R ~string](v interface{}) (R, bool)

func ToTime

func ToTime(v interface{}) (time.Time, bool)

func ToTimeRange

func ToTimeRange(v interface{}) (TimeRange, bool)

func ToUint

func ToUint[R Uint](v interface{}) (R, bool)

func UnwrapNullable

func UnwrapNullable[T any, R any](fn func(v T) (R, bool)) func(v Nullable[T]) (R, bool)

func WrapNullable

func WrapNullable[T any, R any](fn func(v T) (R, bool)) func(v T) (Nullable[R], bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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