schema

package
v1.43.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TableNamespace           = "namespace_config"
	TableTuple               = "relation_tuple"
	TableTupleWithIntegrity  = "relation_tuple_with_integrity"
	TableTransactions        = "transactions"
	TableCaveat              = "caveat"
	TableRelationshipCounter = "relationship_counter"
	TableTransactionMetadata = "transaction_metadata"

	ColNamespace      = "namespace"
	ColConfig         = "serialized_config"
	ColTimestamp      = "timestamp"
	ColTransactionKey = "key"

	ColObjectID = "object_id"
	ColRelation = "relation"

	ColUsersetNamespace = "userset_namespace"
	ColUsersetObjectID  = "userset_object_id"
	ColUsersetRelation  = "userset_relation"

	ColCaveatName        = "name"
	ColCaveatDefinition  = "definition"
	ColCaveatContextName = "caveat_name"
	ColCaveatContext     = "caveat_context"
	ColExpiration        = "expires_at"

	ColIntegrityHash  = "integrity_hash"
	ColIntegrityKeyID = "integrity_key_id"

	ColCounterName             = "name"
	ColCounterSerializedFilter = "serialized_filter"
	ColCounterCurrentCount     = "current_count"
	ColCounterUpdatedAt        = "updated_at_timestamp"
	ColExpiresAt               = "expires_at"
	ColMetadata                = "metadata"
)

Variables

View Source
var IndexPrimaryKey = common.IndexDefinition{
	Name:       "pk_relation_tuple",
	ColumnsSQL: `PRIMARY KEY (namespace, object_id, relation, userset_namespace, userset_object_id, userset_relation)`,
	Shapes: []queryshape.Shape{
		queryshape.CheckPermissionSelectDirectSubjects,
		queryshape.CheckPermissionSelectIndirectSubjects,
		queryshape.FindResourceOfType,
		queryshape.AllSubjectsForResources,
	},
}

IndexPrimaryKey is a synthetic index that represents the primary key of the relation_tuple table.

View Source
var IndexRelationshipBySubject = common.IndexDefinition{
	Name:       "ix_relation_tuple_by_subject",
	ColumnsSQL: `relation_tuple (userset_object_id, userset_namespace, userset_relation, namespace, relation)`,
	Shapes: []queryshape.Shape{
		queryshape.MatchingResourcesForSubject,
		queryshape.FindSubjectOfType,
	},
}

IndexRelationshipBySubject is an index for looking up relationships by subject.

View Source
var IndexRelationshipBySubjectRelation = common.IndexDefinition{
	Name:       "ix_relation_tuple_by_subject_relation",
	ColumnsSQL: `relation_tuple (userset_namespace, userset_relation, namespace, relation)`,
}

IndexRelationshipBySubjectRelation is an index for looking up relationships by subject type and relation. Used by schema delta checking.

View Source
var IndexRelationshipWithIntegrity = common.IndexDefinition{
	Name:       "ix_relation_tuple_with_integrity",
	ColumnsSQL: `relation_tuple_with_integrity (namespace, object_id, relation, userset_namespace, userset_object_id, userset_relation) STORING (integrity_key_id, integrity_hash, timestamp, caveat_name, caveat_context)`,
	Shapes: []queryshape.Shape{
		queryshape.CheckPermissionSelectDirectSubjects,
		queryshape.CheckPermissionSelectIndirectSubjects,
	},
}

IndexRelationshipWithIntegrity is an index for looking up relationships with integrity.

View Source
var NoIndexingHint common.IndexingHint = nil

Functions

func IndexForFilter added in v1.43.0

IndexForFilter returns the index to use for a given relationships filter or nil if no index is forced.

func IndexingHintForQueryShape added in v1.43.0

func IndexingHintForQueryShape(schema common.SchemaInformation, qs queryshape.Shape) common.IndexingHint

IndexingHintForQueryShape returns an indexing hint for the given query shape, if any.

func Schema

func Schema(colOptimizationOpt common.ColumnOptimizationOption, withIntegrity bool, expirationDisabled bool) *common.SchemaInformation

Types

This section is empty.

Jump to

Keyboard shortcuts

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