sentinel

package
v0.1.65 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringUnspecified = "\x00unspecified"

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

Functions

func EqualString added in v0.1.65

func EqualString(a, b StringValue) bool

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

func IsSpecifiedString added in v0.1.65

func IsSpecifiedString(s StringValue) bool

2. IsSpecified - predicate (package-level function)

func IsUnspecifiedString added in v0.1.65

func IsUnspecifiedString(s StringValue) bool

IsUnspecifiedString - convenience predicate

func SameString added in v0.1.65

func SameString(a, b StringValue) bool

7. Same - identity (package-level function)

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 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 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

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