Documentation
¶
Overview ¶
Package predicate provides types and interfaces for conditional operations. It defines predicate logic used in transactional conditional execution.
Index ¶
- type Op
- type Predicate
- func ValueEqual(key []byte, value any) Predicate
- func ValueNotEqual(key []byte, value any) Predicate
- func VersionEqual(key []byte, version int64) Predicate
- func VersionGreater(key []byte, version int64) Predicate
- func VersionLess(key []byte, version int64) Predicate
- func VersionNotEqual(key []byte, version int64) Predicate
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Predicate ¶
type Predicate interface {
// Key returns the key that this predicate applies to.
Key() []byte
// Operation returns the comparison operation (Equal, NotEqual, Greater, Less).
Operation() Op
// Target returns what aspect of the key to compare (Version, Value).
Target() Target
// Value returns the comparison value for the predicate.
Value() any
}
Predicate represents a condition used for conditional operations. Predicates are used in transactions to specify conditions for execution.
func ValueEqual ¶
ValueEqual creates a predicate that checks if a key's value equals the specified value.
func ValueNotEqual ¶
ValueNotEqual creates a predicate that checks if a key's value is not equal to the specified value.
func VersionEqual ¶
VersionEqual creates a predicate that checks if a key's version equals the specified version.
func VersionGreater ¶
VersionGreater creates a predicate that checks if a key's version is greater than the specified version.
func VersionLess ¶
VersionLess creates a predicate that checks if a key's version is less than the specified version.
func VersionNotEqual ¶
VersionNotEqual creates a predicate that checks if a key's version is not equal to the specified version.