value

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package value provides types and functionality to work with config values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Integer

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

Integer represents config integer value that can be configured with issue type level to alert on linting.

func NewInteger

func NewInteger(lvl issue.Type, v int) Integer

NewInteger creates a new config integer value with issue type level and exact value.

func (Integer) Equal

func (i Integer) Equal(other int) bool

Equal defines whether the exact integer value equals the provided integer.

func (Integer) Exact

func (i Integer) Exact() int

Exact returns the exact integer value.

func (Integer) Level

func (i Integer) Level() issue.Type

Level returns issue type level to alert on linting.

func (Integer) String

func (i Integer) String() string

String returns the exact integer value as a string.

func (Integer) WithLevel

func (i Integer) WithLevel(lvl issue.Type) Integer

WithLevel creates a new instance with provided issue type level.

type Pattern

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

Pattern represents config regexp pattern value that can be configured with issue type level to alert on linting.

func NewPattern

func NewPattern(lvl issue.Type, exp *regexp.Regexp) Pattern

NewPattern creates a new config regexp pattern value with issue type level and compiled regexp expression.

func (Pattern) Level

func (p Pattern) Level() issue.Type

Level returns issue type level to alert on linting.

func (Pattern) Match

func (p Pattern) Match(v string) bool

Match defines whether the compiled regexp expression matches the provided string.

func (Pattern) String

func (p Pattern) String() string

String returns the compiled regexp expression as a string.

func (Pattern) WithLevel

func (p Pattern) WithLevel(lvl issue.Type) Pattern

WithLevel creates a new instance with provided issue type level.

type Range

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

Range represents an inclusive integer interval [min, max] that can be configured with an issue type level to alert on linting.

Range is immutable and validates its invariant on every method call: min must not be greater than max.

func NewRange

func NewRange(lvl issue.Type, min, max int) Range

NewRange creates a Range with the provided issue type level and inclusive bounds.

func (Range) Above

func (r Range) Above(n int) bool

Above reports whether n is strictly greater than the upper bound of the interval.

Panics if min is greater than max.

func (Range) Below

func (r Range) Below(n int) bool

Below reports whether n is strictly less than the lower bound of the interval.

Panics if min is greater than max.

func (Range) Empty

func (r Range) Empty() bool

Empty defines whether the range is empty (min and max are zeros).

Panics if min is greater than max.

func (Range) Fit

func (r Range) Fit(n int) bool

Fit reports whether n falls within the inclusive interval [min, max].

Panics if min is greater than max.

func (Range) Level

func (r Range) Level() issue.Type

Level returns issue type level to alert on linting.

func (Range) String

func (r Range) String() string

String returns the canonical "min-max" representation of the interval.

Panics if min is greater than max.

func (Range) WithLevel

func (r Range) WithLevel(lvl issue.Type) Range

WithLevel creates a new instance with provided issue type level.

type String

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

String represents config string value that can be configured with issue type level to alert on linting.

func NewString

func NewString(lvl issue.Type, v string) String

NewString creates a new config string value with issue type level and exact value.

func (String) Empty

func (s String) Empty() bool

Empty defines whether the value is empty.

func (String) Equal

func (s String) Equal(other string) bool

Equal defines whether the exact value equals the provided string.

func (String) Exact

func (s String) Exact() string

Exact returns exact value.

func (String) Level

func (s String) Level() issue.Type

Level returns issue type level to alert on linting.

func (String) String

func (s String) String() string

String returns the exact value.

func (String) WithLevel

func (s String) WithLevel(lvl issue.Type) String

WithLevel creates a new instance with provided issue type level.

type Strings

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

Strings represents a config value that is a slice of strings that can be configured with an issue type level to alert on linting.

func NewStrings

func NewStrings(lvl issue.Type, vv ...string) Strings

NewStrings creates a new config value from a slice of string values with the given issue type level.

func (Strings) Empty

func (s Strings) Empty() bool

Empty defines whether the slice is empty.

func (Strings) Equal

func (s Strings) Equal(other []string) bool

Equal defines whether the slice of exact values equals the provided slice.

func (Strings) Exact

func (s Strings) Exact() []string

Exact returns a copy of the slice of exact values.

func (Strings) Has

func (s Strings) Has(v string, vv ...string) bool

Has defines whether the slice of exact values contains the provided strings.

func (Strings) Level

func (s Strings) Level() issue.Type

Level returns the issue type level to alert on linting.

func (Strings) String

func (s Strings) String() string

String returns a comma-separated string representation of the slice of exact values.

func (Strings) WithLevel

func (s Strings) WithLevel(lvl issue.Type) Strings

WithLevel creates a new instance with provided issue type level.

Jump to

Keyboard shortcuts

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