types

package
v0.0.0-...-df2ac98 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty[T comparable](t T) bool

func Num2Bool

func Num2Bool[T BasicNumberUnion](t Number[T]) bool

func Num2Str

func Num2Str[T BasicNumberUnion](t Number[T]) string

func Str2Num

func Str2Num[T BasicNumberUnion](s string, n Number[T]) (T, error)

Types

type BasicNumberUnion

type BasicNumberUnion interface {
	IntUnion | UintUnion | FloatUnion
}

type BigFloat

type BigFloat big.Float

func (*BigFloat) Bool

func (b *BigFloat) Bool() bool

func (*BigFloat) Box

func (b *BigFloat) Box(t big.Float)

func (*BigFloat) Parse

func (b *BigFloat) Parse(str string) error

func (*BigFloat) String

func (b *BigFloat) String() string

func (*BigFloat) UnBox

func (b *BigFloat) UnBox() big.Float

type BigInt

type BigInt big.Int

func (*BigInt) Bool

func (b *BigInt) Bool() bool

func (*BigInt) Box

func (b *BigInt) Box(t big.Int)

func (*BigInt) Parse

func (b *BigInt) Parse(str string) error

func (*BigInt) String

func (b *BigInt) String() string

func (*BigInt) UnBox

func (b *BigInt) UnBox() big.Int

type BigNumberUnion

type BigNumberUnion interface {
	big.Int | big.Float
}

type C128

type C128 complex128

func (*C128) Bool

func (c *C128) Bool() bool

func (*C128) Box

func (c *C128) Box(t complex128)

func (*C128) Parse

func (c *C128) Parse(str string) error

func (*C128) String

func (c *C128) String() string

func (*C128) UnBox

func (c *C128) UnBox() complex128

type C64

type C64 complex64

func (*C64) Bool

func (c *C64) Bool() bool

func (*C64) Box

func (c *C64) Box(t complex64)

func (*C64) Parse

func (c *C64) Parse(str string) error

func (*C64) String

func (c *C64) String() string

func (*C64) UnBox

func (c *C64) UnBox() complex64

type ComplexUnion

type ComplexUnion interface {
	~complex64 | ~complex128
}

type F32

type F32 float32

func (*F32) Bool

func (f *F32) Bool() bool

func (*F32) Box

func (f *F32) Box(t float32)

func (*F32) Parse

func (f *F32) Parse(str string) error

func (*F32) String

func (f *F32) String() string

func (*F32) UnBox

func (f *F32) UnBox() float32

type F64

type F64 float64

func (*F64) Bool

func (f *F64) Bool() bool

func (*F64) Box

func (f *F64) Box(t float64)

func (*F64) Parse

func (f *F64) Parse(str string) error

func (*F64) String

func (f *F64) String() string

func (*F64) UnBox

func (f *F64) UnBox() float64

type FloatUnion

type FloatUnion interface {
	~float32 | ~float64
}

type I16

type I16 int16

func (*I16) Bool

func (i *I16) Bool() bool

func (*I16) Box

func (i *I16) Box(t int16)

func (*I16) Parse

func (i *I16) Parse(str string) error

func (*I16) String

func (i *I16) String() string

func (*I16) UnBox

func (i *I16) UnBox() int16

type I32

type I32 int8

func (*I32) Bool

func (i *I32) Bool() bool

func (*I32) Box

func (i *I32) Box(t int32)

func (*I32) Parse

func (i *I32) Parse(str string) error

func (*I32) String

func (i *I32) String() string

func (*I32) UnBox

func (i *I32) UnBox() int32

type I64

type I64 int64

func (*I64) Bool

func (i *I64) Bool() bool

func (*I64) Box

func (i *I64) Box(t int64)

func (*I64) Parse

func (i *I64) Parse(str string) error

func (*I64) String

func (i *I64) String() string

func (*I64) UnBox

func (i *I64) UnBox() int64

type I8

type I8 int8

func (*I8) Bool

func (i *I8) Bool() bool

func (*I8) Box

func (i *I8) Box(t int8)

func (*I8) Parse

func (i *I8) Parse(str string) error

func (*I8) String

func (i *I8) String() string

func (*I8) UnBox

func (i *I8) UnBox() int8

type Int

type Int int

func (*Int) Bool

func (i *Int) Bool() bool

func (*Int) Box

func (i *Int) Box(t int)

func (*Int) Parse

func (i *Int) Parse(str string) error

func (*Int) String

func (i *Int) String() string

func (*Int) UnBox

func (i *Int) UnBox() int

type IntUnion

type IntUnion interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Number

type Number[T NumberUnion] interface {
	String() string
	Parse(str string) error
	Bool() bool // convert number to bool
	Box(T)
	UnBox() T
}

type NumberUnion

type NumberUnion interface {
	BasicNumberUnion | ComplexUnion | BigNumberUnion
}

type U16

type U16 uint16

func (*U16) Bool

func (u *U16) Bool() bool

func (*U16) Box

func (u *U16) Box(t uint16)

func (*U16) Parse

func (u *U16) Parse(str string) error

func (*U16) String

func (u *U16) String() string

func (*U16) UnBox

func (u *U16) UnBox() uint16

type U32

type U32 uint32

func (*U32) Bool

func (u *U32) Bool() bool

func (*U32) Box

func (u *U32) Box(t uint32)

func (*U32) Parse

func (u *U32) Parse(str string) error

func (*U32) String

func (u *U32) String() string

func (*U32) UnBox

func (u *U32) UnBox() uint32

type U64

type U64 uint64

func (*U64) Bool

func (u *U64) Bool() bool

func (*U64) Box

func (u *U64) Box(t uint64)

func (*U64) Parse

func (u *U64) Parse(str string) error

func (*U64) String

func (u *U64) String() string

func (*U64) UnBox

func (u *U64) UnBox() uint64

type U8

type U8 uint8

func (*U8) Bool

func (u *U8) Bool() bool

func (*U8) Box

func (u *U8) Box(t uint8)

func (*U8) Parse

func (u *U8) Parse(str string) error

func (*U8) String

func (u *U8) String() string

func (*U8) UnBox

func (u *U8) UnBox() uint8

type Uint

type Uint uint

func (*Uint) Bool

func (u *Uint) Bool() bool

func (*Uint) Box

func (u *Uint) Box(t uint)

func (*Uint) Parse

func (u *Uint) Parse(str string) error

func (*Uint) String

func (u *Uint) String() string

func (*Uint) UnBox

func (u *Uint) UnBox() uint

type UintUnion

type UintUnion interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Jump to

Keyboard shortcuts

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