blob: 1eb64d1a541b54b803ed6d7c6d8a71d6d7df6b4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package common
import "github.com/authzed/spicedb/pkg/datastore/queryshape"
// IndexDefinition is a definition of an index for a datastore.
type IndexDefinition struct {
// Name is the unique name for the index.
Name string
// ColumnsSQL is the SQL fragment of the columns over which this index will apply.
ColumnsSQL string
// Shapes are those query shapes for which this index should be used.
Shapes []queryshape.Shape
// IsDeprecated is true if this index is deprecated and should not be used.
IsDeprecated bool
}
// matchesShape returns true if the index matches the given shape.
func (id IndexDefinition) matchesShape(shape queryshape.Shape) bool {
for _, s := range id.Shapes {
if s == shape {
return true
}
}
return false
}
|