typex

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNullValue = errors.New("value is null")

Functions

func Is

func Is[T any](t1 any) bool

Is returns true if the type of a type is the same as the type of another type.

func Length

func Length(s string) int

func NotNull

func NotNull[T any](ns ...Nullable[T])

func ToCharArray

func ToCharArray(s string) []char

func ToRunes

func ToRunes(cs []char) []rune

func ToString

func ToString(cs []char) string

func TypeOf

func TypeOf[T any]() reflect.Type

TypeOf returns the type of a type.

Types

type ICloneable

type ICloneable[T any] interface {
	Clone() T
}

type INullable

type INullable[T any] interface {
	IsNull() bool
	Value() (T, error)
	NotNull()
	Null()
	UnNull(value T)
}

type Just

type Just[T any] struct {
	// contains filtered or unexported fields
}

func NewJust

func NewJust[T any](value T) *Just[T]

func (*Just[T]) IsJust

func (m *Just[T]) IsJust() bool

func (*Just[T]) IsNothing

func (m *Just[T]) IsNothing() bool

func (*Just[T]) Value

func (m *Just[T]) Value() T

type Maybe

type Maybe[T any] interface {
	IsNothing() bool
	IsJust() bool
	Value() T
}

type MultiType2

type MultiType2[T1, T2 any] struct {
	// contains filtered or unexported fields
}

func NewMultiType2WithT1

func NewMultiType2WithT1[T1, T2 any](obj T1) *MultiType2[T1, T2]

func NewMultiType2WithT2

func NewMultiType2WithT2[T1, T2 any](obj T2) *MultiType2[T1, T2]

func (*MultiType2[T1, T2]) Get

func (m *MultiType2[T1, T2]) Get() any

func (*MultiType2[T1, T2]) GetT1

func (m *MultiType2[T1, T2]) GetT1() T1

func (*MultiType2[T1, T2]) GetT2

func (m *MultiType2[T1, T2]) GetT2() T2

func (*MultiType2[T1, T2]) IsT1

func (m *MultiType2[T1, T2]) IsT1() bool

func (*MultiType2[T1, T2]) IsT2

func (m *MultiType2[T1, T2]) IsT2() bool

func (*MultiType2[T1, T2]) SetT1

func (m *MultiType2[T1, T2]) SetT1(t T1)

func (*MultiType2[T1, T2]) SetT2

func (m *MultiType2[T1, T2]) SetT2(t T2)

type MultiType3

type MultiType3[T1, T2, T3 any] struct {
	// contains filtered or unexported fields
}

func NewMultiType3WithT1

func NewMultiType3WithT1[T1, T2, T3 any](obj T1) *MultiType3[T1, T2, T3]

func NewMultiType3WithT2

func NewMultiType3WithT2[T1, T2, T3 any](obj T2) *MultiType3[T1, T2, T3]

func NewMultiType3WithT3

func NewMultiType3WithT3[T1, T2, T3 any](obj T3) *MultiType3[T1, T2, T3]

func (*MultiType3[T1, T2, T3]) Get

func (m *MultiType3[T1, T2, T3]) Get() any

func (*MultiType3[T1, T2, T3]) GetT1

func (m *MultiType3[T1, T2, T3]) GetT1() T1

func (*MultiType3[T1, T2, T3]) GetT2

func (m *MultiType3[T1, T2, T3]) GetT2() T2

func (*MultiType3[T1, T2, T3]) GetT3

func (m *MultiType3[T1, T2, T3]) GetT3() T3

func (*MultiType3[T1, T2, T3]) IsT1

func (m *MultiType3[T1, T2, T3]) IsT1() bool

func (*MultiType3[T1, T2, T3]) IsT2

func (m *MultiType3[T1, T2, T3]) IsT2() bool

func (*MultiType3[T1, T2, T3]) IsT3

func (m *MultiType3[T1, T2, T3]) IsT3() bool

func (*MultiType3[T1, T2, T3]) SetT1

func (m *MultiType3[T1, T2, T3]) SetT1(t T1)

func (*MultiType3[T1, T2, T3]) SetT2

func (m *MultiType3[T1, T2, T3]) SetT2(t T2)

func (*MultiType3[T1, T2, T3]) SetT3

func (m *MultiType3[T1, T2, T3]) SetT3(t T3)

type Nothing

type Nothing[T any] struct {
}

func NewNothing

func NewNothing[T any]() *Nothing[T]

func (*Nothing[T]) IsJust

func (m *Nothing[T]) IsJust() bool

func (*Nothing[T]) IsNothing

func (m *Nothing[T]) IsNothing() bool

func (*Nothing[T]) Value

func (m *Nothing[T]) Value() T

type Nullable

type Nullable[T any] struct {
	// contains filtered or unexported fields
}

func NewNotNull

func NewNotNull[T any](value T) *Nullable[T]

func NewNull

func NewNull[T any]() *Nullable[T]

func (*Nullable[T]) IsNull

func (n *Nullable[T]) IsNull() bool

func (*Nullable[T]) MarshalJSON

func (n *Nullable[T]) MarshalJSON() ([]byte, error)

func (*Nullable[T]) NotNull

func (n *Nullable[T]) NotNull()

func (*Nullable[T]) Null

func (n *Nullable[T]) Null()

func (*Nullable[T]) UnNull

func (n *Nullable[T]) UnNull(value T)

func (*Nullable[T]) UnmarshalJSON

func (n *Nullable[T]) UnmarshalJSON(b []byte) error

func (*Nullable[T]) Value

func (n *Nullable[T]) Value() (val T, err error)

Jump to

Keyboard shortcuts

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