idxtype

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var T_name = map[int32]string{
	0: "FORWARD",
	1: "INVERTED",
	2: "VECTOR",
}
View Source
var T_value = map[string]int32{
	"FORWARD":  0,
	"INVERTED": 1,
	"VECTOR":   2,
}

Functions

func ErrorText

func ErrorText(t T) redact.SafeString

ErrorText describes the type of the index using the phrase "an inverted index" or "a vector index". This is intended to be included in errors that apply to multiple index types.

Types

type T

type T int32

T represents different types of indexes that can be defined on a table.

const (
	// FORWARD is a standard relational index, containing at most one entry for
	// each row in the table (if a partial index, a table row may not have a
	// corresponding entry in the index).
	FORWARD T = 0
	// INVERTED indexes can contain multiple entries for each row in the table,
	// which is useful for indexing collection or composite data types like JSONB,
	// ARRAY, and GEOGRAPHY.
	INVERTED T = 1
	// VECTOR indexes high-dimensional vectors to enable rapid similarity search
	// using an approximate nearest neighbor (ANN) algorithm.
	VECTOR T = 2
)

func (T) AllowsPrefixColumns

func (t T) AllowsPrefixColumns() bool

AllowsPrefixColumns is true if this index type allows other columns from the table to act as a key prefix that separates indexed values into distinct groupings, e.g. by user or customer.

func (T) CanBePrimary

func (t T) CanBePrimary() bool

CanBePrimary is true if this index type can be the primary index that always contains unique keys sorted according to the primary ordering of the table. Secondary indexes refer to rows in the primary index by unique key value.

func (T) CanBeUnique

func (t T) CanBeUnique() bool

CanBeUnique is true if this index type can be declared as UNIQUE, meaning it never contains duplicate keys.

func (T) EnumDescriptor

func (T) EnumDescriptor() ([]byte, []int)

func (T) HasLinearOrdering

func (t T) HasLinearOrdering() bool

HasLinearOrdering is true if this index type does not define a linear ordering on the last key column in the index. For example, a vector index groups nearby vectors, but does not define a linear ordering among them. As another example, an inverted index only defines a linear ordering for tokens, not for the original JSONB or ARRAY data type.

func (T) String

func (x T) String() string

func (T) SupportsOpClass

func (t T) SupportsOpClass() bool

SupportsOpClass is true if this index type allows columns to specify an operator class, which defines an alternate set of operators used when sorting and querying those columns.

NOTE: Currently, only inverted and vector indexes support operator classes, and only on the last column of the index.

func (T) SupportsSharding

func (t T) SupportsSharding() bool

SupportsSharding is true if this index type can be hash sharded, meaning that its rows are grouped according to a hash value and spread across the keyspace.

func (T) SupportsStoring

func (t T) SupportsStoring() bool

SupportsStoring is true if this index type allows STORING values, which are un-indexed columns from the table that are stored directly in the index for faster retrieval.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL