corerange

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRange

type BaseRange struct {
	RawInput         string
	Separator        string
	IsValid          bool
	HasStart, HasEnd bool
}

func (*BaseRange) BaseRangeClone

func (receiver *BaseRange) BaseRangeClone() *BaseRange

func (*BaseRange) CreateRangeInt

func (receiver *BaseRange) CreateRangeInt(minMax *MinMaxInt) *RangeInt

func (*BaseRange) IsInvalid

func (receiver *BaseRange) IsInvalid() bool

func (*BaseRange) String

func (receiver *BaseRange) String(start, end interface{}) string

type MinMaxByte

type MinMaxByte struct {
	Min, Max byte
}

func (*MinMaxByte) CreateMinMaxInt

func (receiver *MinMaxByte) CreateMinMaxInt() *MinMaxInt

func (*MinMaxByte) CreateRangeInt

func (receiver *MinMaxByte) CreateRangeInt(rawString, separator string) *RangeInt

func (*MinMaxByte) CreateRangeInt16

func (receiver *MinMaxByte) CreateRangeInt16(rawString, separator string) *RangeInt16

func (*MinMaxByte) CreateRangeInt8

func (receiver *MinMaxByte) CreateRangeInt8(rawString, separator string) *RangeInt8

func (*MinMaxByte) Difference

func (receiver *MinMaxByte) Difference() byte

func (*MinMaxByte) DifferenceAbsolute

func (receiver *MinMaxByte) DifferenceAbsolute() byte

func (*MinMaxByte) IsInvalidValue

func (receiver *MinMaxByte) IsInvalidValue(value byte) bool

IsInvalidValue !r.IsWithinRange(value)

func (*MinMaxByte) IsWithinRange

func (receiver *MinMaxByte) IsWithinRange(value byte) bool

IsWithinRange r.Min >= value && value <= r.Max

func (*MinMaxByte) RangeLength

func (receiver *MinMaxByte) RangeLength() byte

RangeLength (5 - 3 = 2) + 1

func (*MinMaxByte) Ranges

func (receiver *MinMaxByte) Ranges() *[]byte

Ranges returns empty ints if IsInvalid return range int values

func (*MinMaxByte) RangesInt

func (receiver *MinMaxByte) RangesInt() *[]byte

RangesInt returns empty ints if IsInvalid return range int values

type MinMaxInt

type MinMaxInt struct {
	Min, Max int
}

func (*MinMaxInt) CreateRangeInt

func (receiver *MinMaxInt) CreateRangeInt(rawString, separator string) *RangeInt

func (*MinMaxInt) Difference

func (receiver *MinMaxInt) Difference() int

func (*MinMaxInt) DifferenceAbsolute

func (receiver *MinMaxInt) DifferenceAbsolute() int

func (*MinMaxInt) IsInvalidValue

func (receiver *MinMaxInt) IsInvalidValue(value int) bool

IsInvalidValue !r.IsWithinRange(value)

func (*MinMaxInt) IsWithinRange

func (receiver *MinMaxInt) IsWithinRange(value int) bool

IsWithinRange r.Min >= value && value <= r.Max

func (*MinMaxInt) RangeLength

func (receiver *MinMaxInt) RangeLength() int

RangeLength (5 - 3 = 2) + 1

func (*MinMaxInt) Ranges

func (receiver *MinMaxInt) Ranges() *[]int

Ranges returns empty ints if IsInvalid return range int values

func (*MinMaxInt) RangesInt

func (receiver *MinMaxInt) RangesInt() *[]int

RangesInt returns empty ints if IsInvalid return range int values

type MinMaxInt16

type MinMaxInt16 struct {
	Min, Max int16
}

func (*MinMaxInt16) CreateMinMaxInt

func (receiver *MinMaxInt16) CreateMinMaxInt() *MinMaxInt

func (*MinMaxInt16) CreateRangeInt

func (receiver *MinMaxInt16) CreateRangeInt(rawString, separator string) *RangeInt

func (*MinMaxInt16) CreateRangeInt16

func (receiver *MinMaxInt16) CreateRangeInt16(rawString, separator string) *RangeInt16

func (*MinMaxInt16) CreateRangeInt8

func (receiver *MinMaxInt16) CreateRangeInt8(rawString, separator string) *RangeInt8

func (*MinMaxInt16) Difference

func (receiver *MinMaxInt16) Difference() int16

func (*MinMaxInt16) DifferenceAbsolute

func (receiver *MinMaxInt16) DifferenceAbsolute() int16

func (*MinMaxInt16) IsInvalidValue

func (receiver *MinMaxInt16) IsInvalidValue(value int16) bool

IsInvalidValue !r.IsWithinRange(value)

func (*MinMaxInt16) IsWithinRange

func (receiver *MinMaxInt16) IsWithinRange(value int16) bool

IsWithinRange r.Min >= value && value <= r.Max

func (*MinMaxInt16) RangeLength

func (receiver *MinMaxInt16) RangeLength() int16

RangeLength (5 - 3 = 2) + 1

func (*MinMaxInt16) Ranges

func (receiver *MinMaxInt16) Ranges() *[]int16

Ranges returns empty ints if IsInvalid return range int values

func (*MinMaxInt16) RangesInt

func (receiver *MinMaxInt16) RangesInt() *[]int16

RangesInt returns empty ints if IsInvalid return range int values

type MinMaxInt8

type MinMaxInt8 struct {
	Min, Max int8
}

func (*MinMaxInt8) CreateMinMaxInt

func (receiver *MinMaxInt8) CreateMinMaxInt() *MinMaxInt

func (*MinMaxInt8) CreateRangeInt

func (receiver *MinMaxInt8) CreateRangeInt(rawString, separator string) *RangeInt

func (*MinMaxInt8) CreateRangeInt16

func (receiver *MinMaxInt8) CreateRangeInt16(rawString, separator string) *RangeInt16

func (*MinMaxInt8) CreateRangeInt8

func (receiver *MinMaxInt8) CreateRangeInt8(rawString, separator string) *RangeInt8

func (*MinMaxInt8) Difference

func (receiver *MinMaxInt8) Difference() int8

func (*MinMaxInt8) DifferenceAbsolute

func (receiver *MinMaxInt8) DifferenceAbsolute() int8

func (*MinMaxInt8) IsInvalidValue

func (receiver *MinMaxInt8) IsInvalidValue(value int8) bool

IsInvalidValue !r.IsWithinRange(value)

func (*MinMaxInt8) IsWithinRange

func (receiver *MinMaxInt8) IsWithinRange(value int8) bool

IsWithinRange r.Min >= value && value <= r.Max

func (*MinMaxInt8) RangeLength

func (receiver *MinMaxInt8) RangeLength() int8

RangeLength (5 - 3 = 2) + 1

func (*MinMaxInt8) Ranges

func (receiver *MinMaxInt8) Ranges() *[]int8

Ranges returns empty ints if IsInvalid return range int values

func (*MinMaxInt8) RangesInt

func (receiver *MinMaxInt8) RangesInt() *[]int8

RangesInt returns empty ints if IsInvalid return range int values

type RangeAny

type RangeAny struct {
	*BaseRange
	RawInput   interface{}
	Start, End interface{}
}

func (*RangeAny) CreateRangeInt

func (r *RangeAny) CreateRangeInt() *RangeInt

func (*RangeAny) CreateRangeIntMinMax

func (r *RangeAny) CreateRangeIntMinMax(minMax *MinMaxInt) *RangeInt

func (*RangeAny) CreateRangeString

func (r *RangeAny) CreateRangeString() *RangeString

func (*RangeAny) CreateStartEndString

func (r *RangeAny) CreateStartEndString() *StartEndString

func (*RangeAny) EndString

func (r *RangeAny) EndString() string

func (*RangeAny) RawInputString

func (r *RangeAny) RawInputString() string

func (*RangeAny) StartString

func (r *RangeAny) StartString() string

func (*RangeAny) String

func (r *RangeAny) String() string

type RangeByte

type RangeByte struct {
	*BaseRange
	Start, End byte
}

func NewRangeByte

func NewRangeByte(
	rawString, separator string,
	minMax *MinMaxByte,
) *RangeByte

func NewRangeByteMinMax

func NewRangeByteMinMax(
	rawString, separator string,
	min, max byte,
) *RangeByte

func (*RangeByte) Difference

func (r *RangeByte) Difference() byte

func (*RangeByte) DifferenceAbsolute

func (r *RangeByte) DifferenceAbsolute() byte

func (*RangeByte) IsInvalidValue

func (r *RangeByte) IsInvalidValue(value byte) bool

IsInvalidValue !r.IsValid || !r.IsWithinRange(value)

func (*RangeByte) IsValidPlusWithinRange

func (r *RangeByte) IsValidPlusWithinRange(value byte) bool

IsValidPlusWithinRange r.IsValid && r.IsWithinRange(value)

func (*RangeByte) IsWithinRange

func (r *RangeByte) IsWithinRange(value byte) bool

IsWithinRange r.Start >= value && value <= r.End

func (*RangeByte) RangeLength

func (r *RangeByte) RangeLength() byte

RangeLength (5 - 3 = 2) + 1

func (*RangeByte) Ranges

func (r *RangeByte) Ranges() *[]byte

Ranges returns empty ints if IsInvalid return range int values

func (*RangeByte) RangesInt

func (r *RangeByte) RangesInt() *[]byte

RangesInt returns empty ints if IsInvalid return range int values

func (*RangeByte) String

func (r *RangeByte) String() string

type RangeInt

type RangeInt struct {
	*BaseRange
	Start, End int
}

func NewRangeInt

func NewRangeInt(
	rawString, separator string,
	minMax *MinMaxInt,
) *RangeInt

NewRangeInt : MinMaxInt represent no validation on start and end range.

func NewRangeIntMinMax

func NewRangeIntMinMax(
	rawString, separator string,
	min, max int,
) *RangeInt

func NewRangeIntUsingValues added in v0.6.8

func NewRangeIntUsingValues(
	start, end int,
	isValid bool,
) *RangeInt

func (*RangeInt) CreateRangeByte

func (r *RangeInt) CreateRangeByte() *RangeByte

func (*RangeInt) CreateRangeInt16

func (r *RangeInt) CreateRangeInt16() *RangeInt16

func (*RangeInt) CreateRangeInt8

func (r *RangeInt) CreateRangeInt8() *RangeInt8

func (*RangeInt) Difference

func (r *RangeInt) Difference() int

func (*RangeInt) DifferenceAbsolute

func (r *RangeInt) DifferenceAbsolute() int

func (*RangeInt) IsInvalidValue

func (r *RangeInt) IsInvalidValue(value int) bool

IsInvalidValue !r.IsValid || !r.IsWithinRange(value)

func (*RangeInt) IsValidPlusWithinRange

func (r *RangeInt) IsValidPlusWithinRange(value int) bool

IsValidPlusWithinRange r.IsValid && r.IsWithinRange(value)

func (*RangeInt) IsWithinRange

func (r *RangeInt) IsWithinRange(value int) bool

IsWithinRange r.Start >= value && value <= r.End

func (*RangeInt) RangeLength

func (r *RangeInt) RangeLength() int

RangeLength (5 - 3 = 2) + 1

func (*RangeInt) Ranges

func (r *RangeInt) Ranges() *[]int

Ranges returns empty ints if IsInvalid return range int values

func (*RangeInt) RangesInt

func (r *RangeInt) RangesInt() *[]int

RangesInt returns empty ints if IsInvalid return range int values

func (*RangeInt) ShallowCreateRangeByte

func (r *RangeInt) ShallowCreateRangeByte() *RangeByte

func (*RangeInt) ShallowCreateRangeInt16

func (r *RangeInt) ShallowCreateRangeInt16() *RangeInt16

func (*RangeInt) ShallowCreateRangeInt8

func (r *RangeInt) ShallowCreateRangeInt8() *RangeInt8

func (*RangeInt) String

func (r *RangeInt) String() string

type RangeInt16

type RangeInt16 struct {
	*BaseRange
	Start, End int16
}

func NewRangeInt16

func NewRangeInt16(
	rawString, separator string,
	minMaxInt16 *MinMaxInt16,
) *RangeInt16

func NewRangeInt16MinMax

func NewRangeInt16MinMax(
	rawString, separator string,
	min, max int16,
) *RangeInt16

func (*RangeInt16) Difference

func (r *RangeInt16) Difference() int16

func (*RangeInt16) DifferenceAbsolute

func (r *RangeInt16) DifferenceAbsolute() int16

func (*RangeInt16) IsInvalidValue

func (r *RangeInt16) IsInvalidValue(value int16) bool

IsInvalidValue !r.IsValid || !r.IsWithinRange(value)

func (*RangeInt16) IsValidPlusWithinRange

func (r *RangeInt16) IsValidPlusWithinRange(value int16) bool

IsValidPlusWithinRange r.IsValid && r.IsWithinRange(value)

func (*RangeInt16) IsWithinRange

func (r *RangeInt16) IsWithinRange(value int16) bool

IsWithinRange r.Start >= value && value <= r.End

func (*RangeInt16) RangeLength

func (r *RangeInt16) RangeLength() int16

RangeLength (5 - 3 = 2) + 1

func (*RangeInt16) Ranges

func (r *RangeInt16) Ranges() *[]int16

Ranges returns empty ints if IsInvalid return range int values

func (*RangeInt16) RangesInt16

func (r *RangeInt16) RangesInt16() *[]int16

RangesInt16 returns empty ints if IsInvalid return range int values

func (*RangeInt16) String

func (r *RangeInt16) String() string

type RangeInt8

type RangeInt8 struct {
	*BaseRange
	Start, End int8
}

func NewRangeInt8

func NewRangeInt8(
	rawString, separator string,
	minMaxInt8 *MinMaxInt8,
) *RangeInt8

func NewRangeInt8MinMax

func NewRangeInt8MinMax(
	rawString, separator string,
	min, max int8,
) *RangeInt8

func (*RangeInt8) Difference

func (r *RangeInt8) Difference() int8

func (*RangeInt8) DifferenceAbsolute

func (r *RangeInt8) DifferenceAbsolute() int8

func (*RangeInt8) IsInvalidValue

func (r *RangeInt8) IsInvalidValue(value int8) bool

IsInvalidValue !r.IsValid || !r.IsWithinRange(value)

func (*RangeInt8) IsValidPlusWithinRange

func (r *RangeInt8) IsValidPlusWithinRange(value int8) bool

IsValidPlusWithinRange r.IsValid && r.IsWithinRange(value)

func (*RangeInt8) IsWithinRange

func (r *RangeInt8) IsWithinRange(value int8) bool

IsWithinRange r.Start >= value && value <= r.End

func (*RangeInt8) RangeLength

func (r *RangeInt8) RangeLength() int8

RangeLength (5 - 3 = 2) + 1

func (*RangeInt8) Ranges

func (r *RangeInt8) Ranges() *[]int8

Ranges returns empty ints if IsInvalid return range int values

func (*RangeInt8) RangesInt8

func (r *RangeInt8) RangesInt8() *[]int8

RangesInt8 returns empty ints if IsInvalid return range int values

func (*RangeInt8) String

func (r *RangeInt8) String() string

type RangeString

type RangeString struct {
	*StartEndString
}

func NewRangeString

func NewRangeString(raw, sep string) *RangeString

func (*RangeString) String

func (r *RangeString) String() string

type StartEndInt added in v0.6.8

type StartEndInt struct {
	Start int `json:"Start"`
	End   int `json:"End"`
}

func (*StartEndInt) HasEnd added in v0.6.8

func (it *StartEndInt) HasEnd() bool

func (*StartEndInt) HasStart added in v0.6.8

func (it *StartEndInt) HasStart() bool

func (*StartEndInt) IsEndGraterThan added in v0.6.8

func (it *StartEndInt) IsEndGraterThan(val int) bool

func (*StartEndInt) IsInvalidAnyStartEnd added in v0.6.8

func (it *StartEndInt) IsInvalidAnyStartEnd() bool

func (*StartEndInt) IsInvalidEnd added in v0.6.8

func (it *StartEndInt) IsInvalidEnd() bool

func (*StartEndInt) IsInvalidStart added in v0.6.8

func (it *StartEndInt) IsInvalidStart() bool

func (*StartEndInt) IsInvalidStartEndBoth added in v0.6.8

func (it *StartEndInt) IsInvalidStartEndBoth() bool

func (*StartEndInt) IsStartEndBothDefined added in v0.6.8

func (it *StartEndInt) IsStartEndBothDefined() bool

func (*StartEndInt) IsStartGraterThan added in v0.6.8

func (it *StartEndInt) IsStartGraterThan(val int) bool

func (*StartEndInt) RangeInt added in v0.6.8

func (it *StartEndInt) RangeInt(minMax *MinMaxInt) *RangeInt

func (*StartEndInt) RangeInt16 added in v0.6.8

func (it *StartEndInt) RangeInt16(minMax *MinMaxInt16) *RangeInt16

func (*StartEndInt) RangeInt8 added in v0.6.8

func (it *StartEndInt) RangeInt8(minMax *MinMaxInt8) *RangeInt8

func (*StartEndInt) StringColon added in v0.6.8

func (it *StartEndInt) StringColon() string

func (*StartEndInt) StringHyphen added in v0.6.8

func (it *StartEndInt) StringHyphen() string

func (*StartEndInt) StringSpace added in v0.6.8

func (it *StartEndInt) StringSpace() string

func (*StartEndInt) StringUsingFormat added in v0.6.8

func (it *StartEndInt) StringUsingFormat(format string) string

type StartEndSimpleString added in v0.6.8

type StartEndSimpleString struct {
	Start string `json:"Start"`
	End   string `json:"End"`
}

func (*StartEndSimpleString) EndValidValue added in v0.6.8

func (it *StartEndSimpleString) EndValidValue() *corestr.ValidValue

func (*StartEndSimpleString) HasEnd added in v0.6.8

func (it *StartEndSimpleString) HasEnd() bool

func (*StartEndSimpleString) HasStart added in v0.6.8

func (it *StartEndSimpleString) HasStart() bool

func (*StartEndSimpleString) IsInvalidAnyStartEnd added in v0.6.8

func (it *StartEndSimpleString) IsInvalidAnyStartEnd() bool

func (*StartEndSimpleString) IsInvalidEnd added in v0.6.8

func (it *StartEndSimpleString) IsInvalidEnd() bool

func (*StartEndSimpleString) IsInvalidStart added in v0.6.8

func (it *StartEndSimpleString) IsInvalidStart() bool

func (*StartEndSimpleString) IsInvalidStartEndBoth added in v0.6.8

func (it *StartEndSimpleString) IsInvalidStartEndBoth() bool

func (*StartEndSimpleString) IsStartEndBothDefined added in v0.6.8

func (it *StartEndSimpleString) IsStartEndBothDefined() bool

func (*StartEndSimpleString) RangeInt added in v0.6.8

func (it *StartEndSimpleString) RangeInt(minMax *MinMaxInt) *RangeInt

func (*StartEndSimpleString) RangeInt16 added in v0.6.8

func (it *StartEndSimpleString) RangeInt16(minMax *MinMaxInt16) *RangeInt16

func (*StartEndSimpleString) RangeInt8 added in v0.6.8

func (it *StartEndSimpleString) RangeInt8(minMax *MinMaxInt8) *RangeInt8

func (*StartEndSimpleString) StartEndString added in v0.6.8

func (it *StartEndSimpleString) StartEndString() *StartEndString

func (*StartEndSimpleString) StartValidValue added in v0.6.8

func (it *StartEndSimpleString) StartValidValue() *corestr.ValidValue

func (*StartEndSimpleString) StringColon added in v0.6.8

func (it *StartEndSimpleString) StringColon() string

func (*StartEndSimpleString) StringHyphen added in v0.6.8

func (it *StartEndSimpleString) StringHyphen() string

func (*StartEndSimpleString) StringSpace added in v0.6.8

func (it *StartEndSimpleString) StringSpace() string

func (*StartEndSimpleString) StringUsingFormat added in v0.6.8

func (it *StartEndSimpleString) StringUsingFormat(format string) string

type StartEndString

type StartEndString struct {
	*BaseRange
	Start, End string
}

func NewStartEndString

func NewStartEndString(raw, sep string) *StartEndString

func NewStartEndStringUsingLines added in v0.5.2

func NewStartEndStringUsingLines(lines []string) *StartEndString

NewStartEndStringUsingLines using first, last index

func (*StartEndString) CreateRangeString

func (r *StartEndString) CreateRangeString() *RangeString

func (*StartEndString) String

func (r *StartEndString) String() string

Jump to

Keyboard shortcuts

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