Documentation
¶
Index ¶
- func EqualIntValue(a, b IntValue) bool
- func EqualString(a, b StringValue) bool
- func IsSpecifiedIntValue(i IntValue) bool
- func IsSpecifiedString(s StringValue) bool
- func IsUnspecifiedIntValue(i IntValue) bool
- func IsUnspecifiedString(s StringValue) bool
- func SameIntValue(a, b IntValue) bool
- func SameString(a, b StringValue) bool
- func SemanticEqualIntValue(a, b IntValue) bool
- func SemanticEqualString(a, b StringValue) bool
- func StringIntValue(i IntValue) string
- func StringString(s StringValue) string
- func TakeOrElse[T comparable](a, b, unspecified T) T
- func TakeOrElsePointer[T any](a, b, unspecified *T) *T
- func TakeOrElseValue[T interface{ ... }](a, b T) T
- type IntValue
- type Sentinel
- type StringValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualIntValue ¶ added in v0.1.66
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
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
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
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
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
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
func CopyIntValue ¶ added in v0.1.66
10. Copy - identity for immutable value types (package-level function)
func MergeIntValue ¶ added in v0.1.66
4. Merge - composition merge (package-level function) Prefers incoming specified values over current values
func TakeOrElseIntValue ¶ added in v0.1.66
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)