generic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package generic contains structures for processing generic values such as numbers and iterables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterable

type Iterable interface {
	Iterate(next NextElementFunc) error
	Count() int
	IsNil() bool
	IsElementImplements(reflectType reflect.Type) bool
}

func NewIterable

func NewIterable(value interface{}) (Iterable, error)

type Key

type Key interface {
	IsIndex() bool
	Index() int
	fmt.Stringer
}

type NextElementFunc

type NextElementFunc func(key Key, value interface{}) error

NextElementFunc used to iterate over iterable via closure. To break cycle closure function needs to return error.

type NotIterableError

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

func (NotIterableError) Error

func (err NotIterableError) Error() string

type NotNumericError

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

func (NotNumericError) Error

func (err NotNumericError) Error() string

type Number

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

func MustNewNumber

func MustNewNumber(value interface{}) Number

func NewNumber

func NewNumber(value interface{}) (*Number, error)

func NewNumberFromFloat

func NewNumberFromFloat(value float64) Number

func NewNumberFromInt

func NewNumberFromInt(value int64) Number

func (Number) IsEqualTo

func (n Number) IsEqualTo(v Number) bool

func (Number) IsGreaterThan

func (n Number) IsGreaterThan(v Number) bool

func (Number) IsLessThan

func (n Number) IsLessThan(v Number) bool

func (Number) IsNil

func (n Number) IsNil() bool

func (Number) IsZero

func (n Number) IsZero() bool

func (Number) String

func (n Number) String() string

Jump to

Keyboard shortcuts

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