# Range

The Range type represents a SurrealDB range value with inclusive or exclusive bounds.

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](https://github.com/surrealdb/surrealdb.go/blob/main/pkg/models/range.go)

---

## Definitions

### `Range` {#range-struct}

```go
type Range[T any, TBeg Bound[T], TEnd Bound[T]] struct {
    Begin *TBeg
    End   *TEnd
}
```

CBOR tag: 49

### `BoundIncluded` {#boundincluded}

An inclusive bound (the value is included in the range).

```go
type BoundIncluded[T any] struct {
    Value T
}
```

CBOR tag: 50

### `BoundExcluded` {#boundexcluded}

An exclusive bound (the value is excluded from the range).

```go
type BoundExcluded[T any] struct {
    Value T
}
```

CBOR tag: 51

### `Bound` {#bound}

The constraint interface for bound types.

```go
type Bound[T any] interface {
    BoundIncluded[T] | BoundExcluded[T]
}
```

---

## Related types

### `RecordRangeID` {#recordrangeid}

A range scoped to a specific table, used for range-based record selection.

```go
type RecordRangeID[T any, TBeg Bound[T], TEnd Bound[T]] struct {
    Range[T, TBeg, TEnd]
    Table Table
}
```

---

## Methods

### `.String()` {#string}

Returns the string representation of the range (e.g., `1..10`, `1>..=10`).

**Returns:** `string`

### `.GetJoinString()` {#getjoinstring}

Returns the range operator string (e.g., `..`, `>..`, `..=`, `>..=`).

**Returns:** `string`

---

## See also

- [Table](/docs/reference/golang/api/values/table.md) for the table name type used in `RecordRangeID`
- [Value types](/docs/reference/golang/concepts/value-types.md) for the full type mapping
- [Data manipulation](/docs/reference/golang/concepts/data-manipulation.md) for using ranges in queries
- [SurrealQL ranges](/docs/reference/query-language/language-primitives/data-types/record-ids.md#record-ranges) for the underlying data model
