constraints

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bias

type Bias struct {
	Size    int // Total size of value that should be scaled
	Scaling int // Defines how much the size is scaled. Range of values: [1, Size]
}

Bias contains Size and Scaling properties which are used to scale constraint limits. Scaling factor is calculated by diving Size with Scaling

type Complex128

type Complex128 struct {
	Real      Float64
	Imaginary Float64
}

func Complex128Default

func Complex128Default() Complex128

type Complex64

type Complex64 struct {
	Real      Float32
	Imaginary Float32
}

func Complex64Default

func Complex64Default() Complex64

type Float32

type Float32 struct {
	Min float32
	Max float32
}

func Float32Default

func Float32Default() Float32

type Float64

type Float64 struct {
	Min float64
	Max float64
}

func Float64Default

func Float64Default() Float64

type Int

type Int struct {
	Min int // Min int value
	Max int // Max int value
}

Int constraints

func IntDefault

func IntDefault() Int

IntDefault returns default int constraints. Underlying architecture defines whether int is int32 or int64 and because of that default min and max constraint values are different.

Spec definition: https://golang.ir/ref/spec#Numeric_types

- For 32bit architecture Int{Min: math.MinInt32, Max: math.MaxInt32}

- For 64bit architecture Int{Min: math.MinInt64, Max: math.MaxInt64}

type Int16

type Int16 struct {
	Min int16
	Max int16
}

func Int16Default

func Int16Default() Int16

type Int32

type Int32 struct {
	Min int32
	Max int32
}

func Int32Default

func Int32Default() Int32

type Int64

type Int64 struct {
	Min int64
	Max int64
}

func Int64Default

func Int64Default() Int64

func (Int64) Biased

func (i Int64) Biased(bias Bias) Int64

type Int8

type Int8 struct {
	Min int8
	Max int8
}

func Int8Default

func Int8Default() Int8

type Length

type Length struct {
	Min uint64
	Max uint64
}

func LengthDefault

func LengthDefault() Length

type Ptr added in v0.4.0

type Ptr struct {
	NilFrequency uint64
}

func PtrDefault added in v0.4.0

func PtrDefault() Ptr

type Rune

type Rune struct {
	MinCodePoint int32
	MaxCodePoint int32
}

func RuneDefault

func RuneDefault() Rune

type String

type String struct {
	Rune   Rune
	Length Length
}

func StringDefault

func StringDefault() String

type Uint

type Uint struct {
	Min uint
	Max uint
}

func UintDefault

func UintDefault() Uint

type Uint16

type Uint16 struct {
	Min uint16
	Max uint16
}

func Uint16Default

func Uint16Default() Uint16

type Uint32

type Uint32 struct {
	Min uint32
	Max uint32
}

func Uint32Default

func Uint32Default() Uint32

type Uint64

type Uint64 struct {
	Min uint64
	Max uint64
}

func Uint64Default

func Uint64Default() Uint64

func (Uint64) Baised

func (u Uint64) Baised(bias Bias) Uint64

type Uint8

type Uint8 struct {
	Min uint8
	Max uint8
}

func Uint8Default

func Uint8Default() Uint8

Jump to

Keyboard shortcuts

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