Range
The Range generic struct represents a SurrealDB range value with configurable bound types. Ranges can have inclusive or exclusive bounds on either end.
Package: github.com/surrealdb/surrealdb.go/pkg/models
Source: pkg/models/range.go
Definitions
Range
type Range[T any, TBeg Bound[T], TEnd Bound[T]] struct {
Begin *TBeg
End *TEnd
}
CBOR tag: 49
BoundIncluded
An inclusive bound (the value is included in the range).
type BoundIncluded[T any] struct {
Value T
}
CBOR tag: 50
BoundExcluded
An exclusive bound (the value is excluded from the range).
type BoundExcluded[T any] struct {
Value T
}
CBOR tag: 51
Bound
The constraint interface for bound types.
type Bound[T any] interface {
BoundIncluded[T] | BoundExcluded[T]
}
RecordRangeID
A range scoped to a specific table, used for range-based record selection.
type RecordRangeID[T any, TBeg Bound[T], TEnd Bound[T]] struct {
Range[T, TBeg, TEnd]
Table Table
}
Methods
.String()
Returns the string representation of the range (e.g., 1..10, 1>..=10).
Returns: string
.GetJoinString()
Returns the range operator string (e.g., .., >.., ..=, >..=).
Returns: string
See Also