Documentation ¶
Index ¶
- func Assert[T any](v any) (T, bool)
- func AssertSafe[T any](v any, fallback T) T
- func IsNilErr(err error) bool
- type Caster
- func (c Caster) Bool() (bool, error)
- func (c Caster) BoolSafe(fallback bool) bool
- func (c Caster) BoolSlice(fallback []bool) []bool
- func (c Caster) Float32() (float32, error)
- func (c Caster) Float32Safe(fallback float32) float32
- func (c Caster) Float32Slice(fallback []float32) []float32
- func (c Caster) Float64() (float64, error)
- func (c Caster) Float64Safe(fallback float64) float64
- func (c Caster) Float64Slice(fallback []float64) []float64
- func (c Caster) Int() (int, error)
- func (c Caster) Int16() (int16, error)
- func (c Caster) Int16Safe(fallback int16) int16
- func (c Caster) Int16Slice(fallback []int16) []int16
- func (c Caster) Int32() (int32, error)
- func (c Caster) Int32Safe(fallback int32) int32
- func (c Caster) Int32Slice(fallback []int32) []int32
- func (c Caster) Int64() (int64, error)
- func (c Caster) Int64Safe(fallback int64) int64
- func (c Caster) Int64Slice(fallback []int64) []int64
- func (c Caster) Int8() (int8, error)
- func (c Caster) Int8Safe(fallback int8) int8
- func (c Caster) Int8Slice(fallback []int8) []int8
- func (c Caster) IntSafe(fallback int) int
- func (c Caster) IntSlice(fallback []int) []int
- func (c Caster) Interface() any
- func (c Caster) IsNil() bool
- func (c Caster) Slice() []any
- func (c Caster) String() (string, error)
- func (c Caster) StringSafe(fallback string) string
- func (c Caster) StringSlice(fallback []string) []string
- func (c Caster) UInt() (uint, error)
- func (c Caster) UInt16() (uint16, error)
- func (c Caster) UInt16Safe(fallback uint16) uint16
- func (c Caster) UInt16Slice(fallback []uint16) []uint16
- func (c Caster) UInt32() (uint32, error)
- func (c Caster) UInt32Safe(fallback uint32) uint32
- func (c Caster) UInt32Slice(fallback []uint32) []uint32
- func (c Caster) UInt64() (uint64, error)
- func (c Caster) UInt64Safe(fallback uint64) uint64
- func (c Caster) UInt64Slice(fallback []uint64) []uint64
- func (c Caster) UInt8() (uint8, error)
- func (c Caster) UInt8Safe(fallback uint8) uint8
- func (c Caster) UInt8Slice(fallback []uint8) []uint8
- func (c Caster) UIntSafe(fallback uint) uint
- func (c Caster) UIntSlice(fallback []uint) []uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertSafe ¶ added in v1.2.3
AssertSafe try to assert value to type T or return fallback
Types ¶
type Caster ¶
type Caster struct {
// contains filtered or unexported fields
}
func (Caster) Float32Safe ¶
Float32Safe parse data as float32 or return fallback
func (Caster) Float32Slice ¶ added in v1.1.0
Float32Slice parse data as []float32 or return fallback
func (Caster) Float64Safe ¶
Float64Safe parse data as float64 or return fallback
func (Caster) Float64Slice ¶ added in v1.1.0
Float64Slice parse data as []float64 or return fallback
func (Caster) Int16Slice ¶ added in v1.1.0
Int16Slice parse data as []int16 or return fallback
func (Caster) Int32Slice ¶ added in v1.1.0
Int32Slice parse data as []int32 or return fallback
func (Caster) Int64Slice ¶ added in v1.1.0
Int64Slice parse data as []int64 or return fallback
func (Caster) StringSafe ¶
StringSafe parse data as string or return fallback
func (Caster) StringSlice ¶ added in v1.1.0
StringSlice parse data as []string or return fallback
func (Caster) UInt16Safe ¶
UInt16Safe parse data as uint16 or return fallback
func (Caster) UInt16Slice ¶ added in v1.1.0
UInt16Slice parse data as []uint16 or return fallback
func (Caster) UInt32Safe ¶
UInt32Safe parse data as uint32 or return fallback
func (Caster) UInt32Slice ¶ added in v1.1.0
UInt32Slice parse data as []uint32 or return fallback
func (Caster) UInt64Safe ¶
UInt64Safe parse data as uint64 or return fallback
func (Caster) UInt64Slice ¶ added in v1.1.0
UInt64Slice parse data as []uint64 or return fallback
func (Caster) UInt8Slice ¶ added in v1.1.0
UInt8Slice parse data as []uint8 or return fallback