objects

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MPL-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrorCodeNotPresent errors.ErrorCode = "ObjectsErrorCodeNotPresent"
)

Variables

This section is empty.

Functions

func SliceFrom added in v0.1.2

func SliceFrom[T any](iterable Iterable[T]) []T

Types

type AbstractObject

type AbstractObject struct{}

func (*AbstractObject) Equals

func (obj *AbstractObject) Equals(other any) bool

func (*AbstractObject) HashCode

func (obj *AbstractObject) HashCode() uint64

func (*AbstractObject) MarshalJSON added in v0.1.3

func (obj *AbstractObject) MarshalJSON() ([]byte, error)

func (*AbstractObject) String added in v0.1.3

func (obj *AbstractObject) String() string

func (*AbstractObject) UnmarshalJSON added in v0.1.3

func (obj *AbstractObject) UnmarshalJSON([]byte) error

type Bool

type Bool struct {
	// contains filtered or unexported fields
}

func WrapBool

func WrapBool(value bool) *Bool

func (*Bool) CompareTo

func (b *Bool) CompareTo(other *Bool) int

func (*Bool) Equals

func (b *Bool) Equals(other any) bool

func (*Bool) HashCode

func (b *Bool) HashCode() uint64

func (*Bool) MarshalJSON added in v0.1.3

func (b *Bool) MarshalJSON() ([]byte, error)

func (*Bool) String added in v0.1.3

func (b *Bool) String() string

func (*Bool) UnmarshalJSON added in v0.1.3

func (b *Bool) UnmarshalJSON(bytes []byte) error

func (*Bool) Unwrap

func (b *Bool) Unwrap() bool

type Comparable

type Comparable[T any] interface {
	CompareTo(other T) int
}

Comparable is an interface for objects that can be compared.

type ComparableObject added in v0.1.2

type ComparableObject[T any] interface {
	Object
	Comparable[T]
}

ComparableObject is an interface for objects that can be compared.

type Comparator

type Comparator[T any] interface {
	Compare(left, right T) int
}

Comparator is an interface for objects that can compare two objects.

func ComparableComparator added in v0.1.2

func ComparableComparator[T Comparable[T]]() Comparator[T]

ComparableComparator returns a comparator that uses the CompareTo method of the given comparable object.

func ReverseComparator added in v0.1.2

func ReverseComparator[T any](comparator Comparator[T]) Comparator[T]

ReverseComparator returns a comparator that reverses the order of the given comparator.

type Float32

type Float32 struct {
	// contains filtered or unexported fields
}

func WrapFloat32

func WrapFloat32(value float32) *Float32

func (*Float32) CompareTo

func (f *Float32) CompareTo(other *Float32) int

func (*Float32) Equals

func (f *Float32) Equals(other any) bool

func (*Float32) HashCode

func (f *Float32) HashCode() uint64

func (*Float32) MarshalJSON added in v0.1.3

func (f *Float32) MarshalJSON() ([]byte, error)

func (*Float32) String added in v0.1.3

func (f *Float32) String() string

func (*Float32) UnmarshalJSON added in v0.1.3

func (f *Float32) UnmarshalJSON(bytes []byte) error

func (*Float32) Unwrap

func (f *Float32) Unwrap() float32

type Float64

type Float64 struct {
	// contains filtered or unexported fields
}

func WrapFloat64

func WrapFloat64(value float64) *Float64

func (*Float64) CompareTo

func (f *Float64) CompareTo(other *Float64) int

func (*Float64) Equals

func (f *Float64) Equals(other any) bool

func (*Float64) HashCode

func (f *Float64) HashCode() uint64

func (*Float64) MarshalJSON added in v0.1.3

func (f *Float64) MarshalJSON() ([]byte, error)

func (*Float64) String added in v0.1.3

func (f *Float64) String() string

func (*Float64) UnmarshalJSON added in v0.1.3

func (f *Float64) UnmarshalJSON(bytes []byte) error

func (*Float64) Unwrap

func (f *Float64) Unwrap() float64

type Int

type Int struct {
	// contains filtered or unexported fields
}

func WrapInt

func WrapInt(value int) *Int

func (*Int) CompareTo

func (i *Int) CompareTo(other *Int) int

func (*Int) Equals

func (i *Int) Equals(other any) bool

func (*Int) HashCode

func (i *Int) HashCode() uint64

func (*Int) MarshalJSON added in v0.1.3

func (i *Int) MarshalJSON() ([]byte, error)

func (*Int) String added in v0.1.3

func (i *Int) String() string

func (*Int) UnmarshalJSON added in v0.1.3

func (i *Int) UnmarshalJSON(bytes []byte) error

func (*Int) Unwrap

func (i *Int) Unwrap() int

type Int16

type Int16 struct {
	// contains filtered or unexported fields
}

func WrapInt16

func WrapInt16(value int16) *Int16

func (*Int16) CompareTo

func (i *Int16) CompareTo(other *Int16) int

func (*Int16) Equals

func (i *Int16) Equals(other any) bool

func (*Int16) HashCode

func (i *Int16) HashCode() uint64

func (*Int16) MarshalJSON added in v0.1.3

func (i *Int16) MarshalJSON() ([]byte, error)

func (*Int16) String added in v0.1.3

func (i *Int16) String() string

func (*Int16) UnmarshalJSON added in v0.1.3

func (i *Int16) UnmarshalJSON(bytes []byte) error

func (*Int16) Unwrap

func (i *Int16) Unwrap() int16

type Int32

type Int32 struct {
	// contains filtered or unexported fields
}

func WrapInt32

func WrapInt32(value int32) *Int32

func (*Int32) CompareTo

func (i *Int32) CompareTo(other *Int32) int

func (*Int32) Equals

func (i *Int32) Equals(other any) bool

func (*Int32) HashCode

func (i *Int32) HashCode() uint64

func (*Int32) MarshalJSON added in v0.1.3

func (i *Int32) MarshalJSON() ([]byte, error)

func (*Int32) String added in v0.1.3

func (i *Int32) String() string

func (*Int32) UnmarshalJSON added in v0.1.3

func (i *Int32) UnmarshalJSON(bytes []byte) error

func (*Int32) Unwrap

func (i *Int32) Unwrap() int32

type Int64

type Int64 struct {
	// contains filtered or unexported fields
}

func WrapInt64

func WrapInt64(value int64) *Int64

func (*Int64) CompareTo

func (i *Int64) CompareTo(other *Int64) int

func (*Int64) Equals

func (i *Int64) Equals(other any) bool

func (*Int64) HashCode

func (i *Int64) HashCode() uint64

func (*Int64) MarshalJSON added in v0.1.3

func (i *Int64) MarshalJSON() ([]byte, error)

func (*Int64) String added in v0.1.3

func (i *Int64) String() string

func (*Int64) UnmarshalJSON added in v0.1.3

func (i *Int64) UnmarshalJSON(bytes []byte) error

func (*Int64) Unwrap

func (i *Int64) Unwrap() int64

type Int8

type Int8 struct {
	// contains filtered or unexported fields
}

func WrapInt8

func WrapInt8(value int8) *Int8

func (*Int8) CompareTo

func (i *Int8) CompareTo(other *Int8) int

func (*Int8) Equals

func (i *Int8) Equals(other any) bool

func (*Int8) HashCode

func (i *Int8) HashCode() uint64

func (*Int8) MarshalJSON added in v0.1.3

func (i *Int8) MarshalJSON() ([]byte, error)

func (*Int8) String added in v0.1.3

func (i *Int8) String() string

func (*Int8) UnmarshalJSON added in v0.1.3

func (i *Int8) UnmarshalJSON(bytes []byte) error

func (*Int8) Unwrap

func (i *Int8) Unwrap() int8

type Iterable

type Iterable[T any] interface {
	Iterator() Iterator[T]
}

type IterableObject added in v0.1.2

type IterableObject[T any] interface {
	Object
	Iterable[T]
}

type Iterator

type Iterator[T any] interface {
	HasNext() bool
	Next() T
}

type Number added in v0.1.3

type Number struct {
	// contains filtered or unexported fields
}

func WrapNumber added in v0.1.3

func WrapNumber(value json.Number) *Number

func (*Number) CompareTo added in v0.1.3

func (n *Number) CompareTo(other *Number) int

func (*Number) Equals added in v0.1.3

func (n *Number) Equals(other any) bool

func (*Number) Float64 added in v0.1.3

func (n *Number) Float64() (float64, error)

func (*Number) HashCode added in v0.1.3

func (n *Number) HashCode() uint64

func (*Number) Int64 added in v0.1.3

func (n *Number) Int64() (int64, error)

func (*Number) MarshalJSON added in v0.1.3

func (n *Number) MarshalJSON() ([]byte, error)

func (*Number) String added in v0.1.3

func (n *Number) String() string

func (*Number) UnmarshalJSON added in v0.1.3

func (n *Number) UnmarshalJSON(bytes []byte) error

func (*Number) Unwrap added in v0.1.3

func (n *Number) Unwrap() json.Number

type Object

type Object interface {
	json.Marshaler
	json.Unmarshaler

	Equals(other any) bool
	HashCode() uint64
	String() string
}

type Optional added in v0.1.1

type Optional[V any] interface {
	Object

	Get() V
	GetSafe() (V, error)

	IsEmpty() bool
}

func EmptyOptional added in v0.1.1

func EmptyOptional[V Object]() Optional[V]

func OptionalOf added in v0.1.1

func OptionalOf[V Object](value V) Optional[V]

type String

type String struct {
	// contains filtered or unexported fields
}

func WrapString

func WrapString(value string) *String

func (*String) CompareTo

func (s *String) CompareTo(other *String) int

func (*String) Equals

func (s *String) Equals(other any) bool

func (*String) HashCode

func (s *String) HashCode() uint64

func (*String) MarshalJSON added in v0.1.3

func (s *String) MarshalJSON() ([]byte, error)

func (*String) String added in v0.1.3

func (s *String) String() string

func (*String) UnmarshalJSON added in v0.1.3

func (s *String) UnmarshalJSON(bytes []byte) error

func (*String) Unwrap

func (s *String) Unwrap() string

type UInt

type UInt struct {
	// contains filtered or unexported fields
}

func WrapUInt

func WrapUInt(value uint) *UInt

func (*UInt) CompareTo

func (i *UInt) CompareTo(other *UInt) int

func (*UInt) Equals

func (i *UInt) Equals(other any) bool

func (*UInt) HashCode

func (i *UInt) HashCode() uint64

func (*UInt) MarshalJSON added in v0.1.3

func (i *UInt) MarshalJSON() ([]byte, error)

func (*UInt) String added in v0.1.3

func (i *UInt) String() string

func (*UInt) UnmarshalJSON added in v0.1.3

func (i *UInt) UnmarshalJSON(bytes []byte) error

func (*UInt) Unwrap

func (i *UInt) Unwrap() uint

type UInt16

type UInt16 struct {
	// contains filtered or unexported fields
}

func WrapUInt16

func WrapUInt16(value uint16) *UInt16

func (*UInt16) CompareTo

func (i *UInt16) CompareTo(other *UInt16) int

func (*UInt16) Equals

func (i *UInt16) Equals(other any) bool

func (*UInt16) HashCode

func (i *UInt16) HashCode() uint64

func (*UInt16) MarshalJSON added in v0.1.3

func (i *UInt16) MarshalJSON() ([]byte, error)

func (*UInt16) String added in v0.1.3

func (i *UInt16) String() string

func (*UInt16) UnmarshalJSON added in v0.1.3

func (i *UInt16) UnmarshalJSON(bytes []byte) error

func (*UInt16) Unwrap

func (i *UInt16) Unwrap() uint16

type UInt32

type UInt32 struct {
	// contains filtered or unexported fields
}

func WrapUInt32

func WrapUInt32(value uint32) *UInt32

func (*UInt32) CompareTo

func (i *UInt32) CompareTo(other *UInt32) int

func (*UInt32) Equals

func (i *UInt32) Equals(other any) bool

func (*UInt32) HashCode

func (i *UInt32) HashCode() uint64

func (*UInt32) MarshalJSON added in v0.1.3

func (i *UInt32) MarshalJSON() ([]byte, error)

func (*UInt32) String added in v0.1.3

func (i *UInt32) String() string

func (*UInt32) UnmarshalJSON added in v0.1.3

func (i *UInt32) UnmarshalJSON(bytes []byte) error

func (*UInt32) Unwrap

func (i *UInt32) Unwrap() uint32

type UInt64

type UInt64 struct {
	// contains filtered or unexported fields
}

func WrapUInt64

func WrapUInt64(value uint64) *UInt64

func (*UInt64) CompareTo

func (i *UInt64) CompareTo(other *UInt64) int

func (*UInt64) Equals

func (i *UInt64) Equals(other any) bool

func (*UInt64) HashCode

func (i *UInt64) HashCode() uint64

func (*UInt64) MarshalJSON added in v0.1.3

func (i *UInt64) MarshalJSON() ([]byte, error)

func (*UInt64) String added in v0.1.3

func (i *UInt64) String() string

func (*UInt64) UnmarshalJSON added in v0.1.3

func (i *UInt64) UnmarshalJSON(bytes []byte) error

func (*UInt64) Unwrap

func (i *UInt64) Unwrap() uint64

type UInt8

type UInt8 struct {
	// contains filtered or unexported fields
}

func WrapUInt8

func WrapUInt8(value uint8) *UInt8

func (*UInt8) CompareTo

func (i *UInt8) CompareTo(other *UInt8) int

func (*UInt8) Equals

func (i *UInt8) Equals(other any) bool

func (*UInt8) HashCode

func (i *UInt8) HashCode() uint64

func (*UInt8) MarshalJSON added in v0.1.3

func (i *UInt8) MarshalJSON() ([]byte, error)

func (*UInt8) String added in v0.1.3

func (i *UInt8) String() string

func (*UInt8) UnmarshalJSON added in v0.1.3

func (i *UInt8) UnmarshalJSON(bytes []byte) error

func (*UInt8) Unwrap

func (i *UInt8) Unwrap() uint8

Jump to

Keyboard shortcuts

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