sentinel

package
v0.1.70 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualIntValue added in v0.1.66

func EqualIntValue(a, b IntValue) bool

9. Equal - equality check (package-level function)

func EqualString added in v0.1.65

func EqualString(a, b StringValue) bool

9. Equal - equality check (package-level function)

func IsSpecifiedIntValue added in v0.1.66

func IsSpecifiedIntValue(i IntValue) bool

2. IsSpecified - predicate (package-level function)

func IsSpecifiedString added in v0.1.65

func IsSpecifiedString(s StringValue) bool

2. IsSpecified - predicate (package-level function)

func IsUnspecifiedIntValue added in v0.1.66

func IsUnspecifiedIntValue(i IntValue) bool

IsUnspecifiedIntValue - convenience predicate

func IsUnspecifiedString added in v0.1.65

func IsUnspecifiedString(s StringValue) bool

IsUnspecifiedString - convenience predicate

func SameIntValue added in v0.1.66

func SameIntValue(a, b IntValue) bool

7. Same - identity (package-level function)

func SameString added in v0.1.65

func SameString(a, b StringValue) bool

7. Same - identity (package-level function)

func SemanticEqualIntValue added in v0.1.66

func SemanticEqualIntValue(a, b IntValue) bool

8. SemanticEqual - semantic equality (package-level function) For ints, this is the same as Same

func SemanticEqualString added in v0.1.65

func SemanticEqualString(a, b StringValue) bool

8. SemanticEqual - semantic equality (package-level function) For strings, this is the same as Same

func StringIntValue added in v0.1.66

func StringIntValue(i IntValue) string

5. String - stringification (package-level function)

func StringString added in v0.1.65

func StringString(s StringValue) string

5. String - stringification (package-level function)

func TakeOrElse

func TakeOrElse[T comparable](a, b, unspecified T) T

unspecified is the sentinel value

func TakeOrElsePointer

func TakeOrElsePointer[T any](a, b, unspecified *T) *T

golang interface or pointer receiver

func TakeOrElseValue

func TakeOrElseValue[T interface{ IsSpecified() bool }](a, b T) T

Generic TakeOrElse for any type with IsSpecified() method golang interface or value receiver DO NOT PASS NIL as arguments

Types

type IntValue added in v0.1.66

type IntValue = int
const IntUnspecified IntValue = IntValueUnspecified

Deprecated: Use IntValueUnspecified instead

const IntValueUnspecified IntValue = math.MinInt

func CopyIntValue added in v0.1.66

func CopyIntValue(i IntValue) IntValue

10. Copy - identity for immutable value types (package-level function)

func MergeIntValue added in v0.1.66

func MergeIntValue(a, b IntValue) IntValue

4. Merge - composition merge (package-level function) Prefers incoming specified values over current values

func TakeOrElseIntValue added in v0.1.66

func TakeOrElseIntValue(a, b IntValue) IntValue

3. TakeOrElse - 2-param fallback (package-level function)

type Sentinel

type Sentinel interface {
	IsSpecified() bool
	// contains filtered or unexported methods
}

Do not implement this interface on complex objects value classes inline to primitives, and Unspecified is just the zero bit pattern.

type StringValue added in v0.1.65

type StringValue = string
const StringUnspecified StringValue = StringValueUnspecified

Deprecated: Use StringValueUnspecified instead

const StringValueUnspecified StringValue = "\x00unspecified"

1. Sentinel - StringValueUnspecified StringValue is the type for sentinel string pattern. The sentinel "\x00unspecified" is used when empty string is meaningful.

func CopyString added in v0.1.65

func CopyString(s StringValue) StringValue

10. Copy - identity for immutable value types (package-level function)

func MergeString added in v0.1.65

func MergeString(a, b StringValue) StringValue

4. Merge - composition merge (package-level function) Prefers incoming specified values over current values

func TakeOrElseString

func TakeOrElseString(a, b StringValue) StringValue

3. TakeOrElse - 2-param fallback (package-level function)

Jump to

Keyboard shortcuts

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