common

package
v1.45.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Code generated by github.com/ecordell/optgen. DO NOT EDIT.

Index

Constants

View Source
const (
	PaginationFilterTypeUnknown PaginationFilterType = iota

	// TupleComparison uses a comparison with a compound key,
	// e.g. (namespace, object_id, relation) > ('ns', '123', 'viewer')
	// which is not compatible with all datastores.
	TupleComparison = 1

	// ExpandedLogicComparison comparison uses a nested tree of ANDs and ORs to properly
	// filter out already received relationships. Useful for databases that do not support
	// tuple comparison, or do not execute it efficiently
	ExpandedLogicComparison = 2
)

Variables

View Source
var (
	// CaveatNameKey is a tracing attribute representing a caveat name
	CaveatNameKey = attribute.Key("authzed.com/spicedb/sql/caveatName")

	// ObjNamespaceNameKey is a tracing attribute representing the resource
	// object type.
	ObjNamespaceNameKey = attribute.Key("authzed.com/spicedb/sql/objNamespaceName")

	// ObjRelationNameKey is a tracing attribute representing the resource
	// relation.
	ObjRelationNameKey = attribute.Key("authzed.com/spicedb/sql/objRelationName")

	// ObjIDKey is a tracing attribute representing the resource object ID.
	ObjIDKey = attribute.Key("authzed.com/spicedb/sql/objId")

	// SubNamespaceNameKey is a tracing attribute representing the subject object
	// type.
	SubNamespaceNameKey = attribute.Key("authzed.com/spicedb/sql/subNamespaceName")

	// SubRelationNameKey is a tracing attribute representing the subject
	// relation.
	SubRelationNameKey = attribute.Key("authzed.com/spicedb/sql/subRelationName")

	// SubObjectIDKey is a tracing attribute representing the the subject object
	// ID.
	SubObjectIDKey = attribute.Key("authzed.com/spicedb/sql/subObjectId")
)
View Source
var MaxGCInterval = 60 * time.Minute

Functions

func BuildLikePrefixClause added in v1.44.0

func BuildLikePrefixClause(columnName string, prefix string) (sq.Like, error)

BuildLikePrefixClause builds a LIKE clause for the given column name and prefix.

func ColumnsToSelect added in v1.40.0

func ColumnsToSelect[CN any, CC any, EC any](
	b RelationshipsQueryBuilder,
	resourceObjectType *string,
	resourceObjectID *string,
	resourceRelation *string,
	subjectObjectType *string,
	subjectObjectID *string,
	subjectRelation *string,
	caveatName *CN,
	caveatCtx *CC,
	expiration EC,

	integrityKeyID *string,
	integrityHash *[]byte,
	timestamp *time.Time,
) ([]any, error)

ColumnsToSelect returns the columns to select for a given query. The columns provided are the references to the slots in which the values for each relationship will be placed.

func ContextualizedCaveatFrom added in v1.14.0

func ContextualizedCaveatFrom(name string, context map[string]any) (*core.ContextualizedCaveat, error)

ContextualizedCaveatFrom convenience method that handles creation of a contextualized caveat given the possibility of arguments with zero-values.

func IsCancellationError added in v1.41.0

func IsCancellationError(err error) bool

IsCancellationError determines if an error returned by pgx has been caused by context cancellation.

func IsResettableError added in v1.41.0

func IsResettableError(err error) bool

IsResettableError returns whether the given error is a resettable error.

func LogOnError added in v1.14.0

func LogOnError(ctx context.Context, f func() error)

LogOnError executes the function and logs the error. Useful to avoid silently ignoring errors in defer statements

func MetricsIDFromURL added in v1.42.0

func MetricsIDFromURL(dsURL string) (string, error)

MetricsIDFromURL extracts the metrics ID from a given datastore URL.

func NewCreateRelationshipExistsError added in v1.12.0

func NewCreateRelationshipExistsError(relationship *tuple.Relationship) error

NewCreateRelationshipExistsError creates a new CreateRelationshipExistsError.

func NewReadOnlyTransactionError added in v1.35.3

func NewReadOnlyTransactionError(err error) error

NewReadOnlyTransactionError creates a new ReadOnlyTransactionError.

func NewRevisionUnavailableError added in v1.35.0

func NewRevisionUnavailableError(err error) error

NewRevisionUnavailableError creates a new RevisionUnavailableError.

func NewSerializationError added in v1.26.0

func NewSerializationError(err error) error

NewSerializationError creates a new SerializationError

func NewSliceRelationshipIterator added in v1.21.0

func NewSliceRelationshipIterator(rels []tuple.Relationship) datastore.RelationshipIterator

NewSliceRelationshipIterator creates a datastore.RelationshipIterator instance from a materialized slice of tuples.

func NewWriteOverLimitError added in v1.45.2

func NewWriteOverLimitError(err error) error

NewWriteOverLimitError creates a new WriteOverLimitError.

func QueryRelationships added in v1.40.0

func QueryRelationships[R Rows, C ~map[string]any](ctx context.Context, builder RelationshipsQueryBuilder, tx Querier[R], explainable datastore.Explainable) (datastore.RelationshipIterator, error)

QueryRelationships queries relationships for the given query and transaction.

func RedactAndLogSensitiveConnString added in v1.27.0

func RedactAndLogSensitiveConnString(ctx context.Context, baseErr string, err error, pgURL string) error

RedactAndLogSensitiveConnString elides the given error, logging it only at trace level (after being redacted).

func RegisterGCMetrics added in v1.10.0

func RegisterGCMetrics() error

RegisterGCMetrics registers garbage collection metrics to the default registry.

func RunGarbageCollection added in v1.16.0

func RunGarbageCollection(collectable GarbageCollectableDatastore, window, timeout time.Duration) error

RunGarbageCollection runs garbage collection for the datastore.

func StartGarbageCollector added in v1.10.0

func StartGarbageCollector(ctx context.Context, collectable GarbageCollectableDatastore, interval, window, timeout time.Duration) error

StartGarbageCollector loops forever until the context is canceled and performs garbage collection on the provided interval.

func UpdateRelationshipsInDatastore added in v1.39.0

func UpdateRelationshipsInDatastore(ctx context.Context, ds datastore.Datastore, updates ...tuple.RelationshipUpdate) (datastore.Revision, error)

UpdateRelationshipsInDatastore is a convenience method to perform multiple relation update operations on a Datastore

func WriteRelationships added in v1.39.0

func WriteRelationships(ctx context.Context, ds datastore.Datastore, op tuple.UpdateOperation, rels ...tuple.Relationship) (datastore.Revision, error)

WriteRelationships is a convenience method to perform the same update operation on a set of relationships

Types

type Changes added in v1.3.0

type Changes[R datastore.Revision, K comparable] struct {
	// contains filtered or unexported fields
}

Changes represents a set of datastore mutations that are kept self-consistent across one or more transaction revisions.

func NewChanges added in v1.3.0

func NewChanges[R datastore.Revision, K comparable](keyFunc func(R) K, content datastore.WatchContent, maxByteSize uint64) *Changes[R, K]

NewChanges creates a new Changes object for change tracking and de-duplication.

func (*Changes[R, K]) AddChangedDefinition added in v1.29.0

func (ch *Changes[R, K]) AddChangedDefinition(
	ctx context.Context,
	rev R,
	def datastore.SchemaDefinition,
) error

AddChangedDefinition adds a change indicating that the schema definition (namespace or caveat) was changed to the definition given.

func (*Changes[R, K]) AddDeletedCaveat added in v1.29.0

func (ch *Changes[R, K]) AddDeletedCaveat(
	_ context.Context,
	rev R,
	caveatName string,
) error

AddDeletedCaveat adds a change indicating that the caveat with the name was deleted.

func (*Changes[R, K]) AddDeletedNamespace added in v1.29.0

func (ch *Changes[R, K]) AddDeletedNamespace(
	_ context.Context,
	rev R,
	namespaceName string,
) error

AddDeletedNamespace adds a change indicating that the namespace with the name was deleted.

func (*Changes[R, K]) AddRelationshipChange added in v1.29.0

func (ch *Changes[R, K]) AddRelationshipChange(
	ctx context.Context,
	rev R,
	rel tuple.Relationship,
	op tuple.UpdateOperation,
) error

AddRelationshipChange adds a specific change to the complete list of tracked changes

func (*Changes[R, K]) AsRevisionChanges added in v1.3.0

func (ch *Changes[R, K]) AsRevisionChanges(lessThanFunc func(lhs, rhs K) bool) ([]datastore.RevisionChanges, error)

AsRevisionChanges returns the list of changes processed so far as a datastore watch compatible, ordered, changelist.

func (*Changes[R, K]) FilterAndRemoveRevisionChanges added in v1.29.0

func (ch *Changes[R, K]) FilterAndRemoveRevisionChanges(lessThanFunc func(lhs, rhs K) bool, boundRev R) ([]datastore.RevisionChanges, error)

FilterAndRemoveRevisionChanges filters a list of changes processed up to the bound revision from the changes list, removing them and returning the filtered changes.

func (*Changes[R, K]) IsEmpty added in v1.29.0

func (ch *Changes[R, K]) IsEmpty() bool

IsEmpty returns if the change set is empty.

func (*Changes[R, K]) SetRevisionMetadata added in v1.38.0

func (ch *Changes[R, K]) SetRevisionMetadata(ctx context.Context, rev R, metadata map[string]any) error

SetRevisionMetadata sets the metadata for the given revision.

type ColumnOptimizationOption added in v1.40.0

type ColumnOptimizationOption int

ColumnOptimizationOption is an enumerator for column optimization options.

const (
	ColumnOptimizationOptionUnknown ColumnOptimizationOption = iota

	// ColumnOptimizationOptionNone is the default option, which does not optimize the static columns.
	ColumnOptimizationOptionNone

	// ColumnOptimizationOptionStaticValues is an option that optimizes columns for static values.
	ColumnOptimizationOptionStaticValues
)

type CreateRelationshipExistsError added in v1.12.0

type CreateRelationshipExistsError struct {

	// Relationship is the relationship that caused the error. May be nil, depending on the datastore.
	Relationship *tuple.Relationship
	// contains filtered or unexported fields
}

CreateRelationshipExistsError is an error returned when attempting to CREATE an already-existing relationship.

func (CreateRelationshipExistsError) GRPCStatus added in v1.22.0

func (err CreateRelationshipExistsError) GRPCStatus() *status.Status

GRPCStatus implements retrieving the gRPC status for the error.

type DeletionCounts added in v1.10.0

type DeletionCounts struct {
	Relationships int64
	Transactions  int64
	Namespaces    int64
}

DeletionCounts tracks the amount of deletions that occurred when calling DeleteBeforeTx.

func (DeletionCounts) MarshalZerologObject added in v1.10.0

func (g DeletionCounts) MarshalZerologObject(e *zerolog.Event)

type ExecuteReadRelsQueryFunc added in v1.40.0

type ExecuteReadRelsQueryFunc func(ctx context.Context, builder RelationshipsQueryBuilder) (datastore.RelationshipIterator, error)

ExecuteReadRelsQueryFunc is a function that can be used to execute a single rendered SQL query.

type GarbageCollectableDatastore added in v1.43.0

type GarbageCollectableDatastore interface {
	// BuildGarbageCollector builds a garbage collector for the datastore.
	//
	// Each instance is considered isolated and will be used for the duration
	// of a *single* garbage collection call.
	BuildGarbageCollector(ctx context.Context) (GarbageCollector, error)

	// ReadyState returns the current state of the datastore. Note that this does not
	// operate over the dedicated connection.
	ReadyState(context.Context) (datastore.ReadyState, error)

	// HasGCRun returns true if a garbage collection run has been completed.
	HasGCRun() bool

	// MarkGCCompleted marks that a garbage collection run has been completed.
	MarkGCCompleted()

	// ResetGCCompleted resets the state of the garbage collection run.
	ResetGCCompleted()
}

GarbageCollectableDatastore represents a datastore supporting external and explicit garbage collection.

type GarbageCollector added in v1.10.0

type GarbageCollector interface {
	// LockForGCRun attempts to acquire a lock for garbage collection. This lock
	// is typically done at the datastore level, to ensure that no other nodes are
	// running garbage collection at the same time.
	LockForGCRun(ctx context.Context) (bool, error)

	// UnlockAfterGCRun releases the lock after a garbage collection run.
	// NOTE: this method does not take a context, as the context used for the
	// reset of the GC run can be canceled/timed out and the unlock will still need to happen.
	UnlockAfterGCRun() error

	// Now returns the current time from the datastore.
	Now(context.Context) (time.Time, error)

	// TxIDBefore returns the highest transaction ID before the provided time.
	TxIDBefore(context.Context, time.Time) (datastore.Revision, error)

	// DeleteBeforeTx deletes all data before the provided transaction ID.
	DeleteBeforeTx(ctx context.Context, txID datastore.Revision) (DeletionCounts, error)

	// DeleteExpiredRels deletes all relationships that have expired.
	DeleteExpiredRels(ctx context.Context) (int64, error)

	// Close closes the garbage collector.
	Close()
}

GarbageCollector represents a runnable garbage collector for a datastore.

type IndexDefinition added in v1.42.0

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
}

IndexDefinition is a definition of an index for a datastore.

type IndexingHint added in v1.43.0

type IndexingHint interface {
	// SQLPrefix returns the SQL prefix to be used for the indexing hint, if any.
	SQLPrefix() (string, error)

	// FromTable returns the table name to be used for the indexing hint, if any.
	FromTable(existingTableName string) (string, error)

	// FromSQLSuffix returns the suffix to be used for the indexing hint, if any.
	FromSQLSuffix() (string, error)
}

IndexingHint is an interface that can be implemented to provide a hint for the SQL query.

type MigrationValidator added in v1.39.0

type MigrationValidator struct {
	// contains filtered or unexported fields
}

func NewMigrationValidator added in v1.39.0

func NewMigrationValidator(headMigration string, additionalAllowedMigrations []string) *MigrationValidator

func (*MigrationValidator) MigrationReadyState added in v1.39.0

func (mv *MigrationValidator) MigrationReadyState(version string) datastore.ReadyState

MigrationReadyState returns the readiness of the datastore for the given version.

type PaginationFilterType added in v1.21.0

type PaginationFilterType uint8

PaginationFilterType is an enumerator for pagination filter types.

type Querier added in v1.40.0

type Querier[R Rows] interface {
	QueryFunc(ctx context.Context, f func(context.Context, R) error, sql string, args ...any) error
}

Querier is an interface for querying the database.

type QueryRelationshipsExecutor added in v1.40.0

type QueryRelationshipsExecutor struct {
	Executor ExecuteReadRelsQueryFunc
}

QueryRelationshipsExecutor is a relationships query runner shared by SQL implementations of the datastore.

func (QueryRelationshipsExecutor) ExecuteQuery added in v1.40.0

ExecuteQuery executes the query.

type ReadOnlyTransactionError added in v1.35.3

type ReadOnlyTransactionError struct {
	// contains filtered or unexported fields
}

ReadOnlyTransactionError is returned when an otherwise read-write transaction fails on writes with an error indicating that the datastore is currently in a read-only mode.

func (ReadOnlyTransactionError) GRPCStatus added in v1.35.3

func (err ReadOnlyTransactionError) GRPCStatus() *status.Status

type RelationshipsQueryBuilder added in v1.40.0

type RelationshipsQueryBuilder struct {
	Schema         SchemaInformation
	SkipCaveats    bool
	SkipExpiration bool

	SQLCheckAssertionForTest  options.SQLCheckAssertionForTest
	SQLExplainCallbackForTest options.SQLExplainCallbackForTest
	// contains filtered or unexported fields
}

RelationshipsQueryBuilder is a builder for producing the SQL and arguments necessary for reading relationships.

func (RelationshipsQueryBuilder) FilteringValuesForTesting added in v1.40.0

func (b RelationshipsQueryBuilder) FilteringValuesForTesting() map[string]columnTracker

FilteringValuesForTesting returns the filtering values. For test use only.

func (RelationshipsQueryBuilder) SelectSQL added in v1.40.0

func (b RelationshipsQueryBuilder) SelectSQL() (string, []any, error)

SelectSQL returns the SQL and arguments necessary for reading relationships.

type RevisionUnavailableError added in v1.35.0

type RevisionUnavailableError struct {
	// contains filtered or unexported fields
}

RevisionUnavailableError is returned when a revision is not available on a replica.

type Rows added in v1.40.0

type Rows interface {
	Scan(dest ...any) error
	Next() bool
	Err() error
}

Rows is a common interface for database rows reading.

type SchemaInformation

type SchemaInformation struct {
	RelationshipTableName string `debugmap:"visible"`

	ColNamespace        string `debugmap:"visible"`
	ColObjectID         string `debugmap:"visible"`
	ColRelation         string `debugmap:"visible"`
	ColUsersetNamespace string `debugmap:"visible"`
	ColUsersetObjectID  string `debugmap:"visible"`
	ColUsersetRelation  string `debugmap:"visible"`

	ColCaveatName    string `debugmap:"visible"`
	ColCaveatContext string `debugmap:"visible"`

	ColExpiration string `debugmap:"visible"`

	ColIntegrityKeyID     string `debugmap:"visible"`
	ColIntegrityHash      string `debugmap:"visible"`
	ColIntegrityTimestamp string `debugmap:"visible"`

	// Indexes are the indexes to use for this schema.
	Indexes []IndexDefinition `debugmap:"visible"`

	// PaginationFilterType is the type of pagination filter to use for this schema.
	PaginationFilterType PaginationFilterType `debugmap:"visible"`

	// PlaceholderFormat is the format of placeholders to use for this schema.
	PlaceholderFormat sq.PlaceholderFormat `debugmap:"visible"`

	// NowFunction is the function to use to get the current time in the datastore.
	NowFunction string `debugmap:"visible"`

	// ColumnOptimization is the optimization to use for columns in the schema, if any.
	ColumnOptimization ColumnOptimizationOption `debugmap:"visible"`

	// IntegrityEnabled is a flag to indicate if the schema has integrity columns.
	IntegrityEnabled bool `debugmap:"visible"`

	// ExpirationDisabled is a flag to indicate whether expiration support is disabled.
	ExpirationDisabled bool `debugmap:"visible"`

	// SortByResourceColumnOrder is the order of the resource columns in the schema to use
	// when sorting by resource. If unspecified, the default will be used.
	SortByResourceColumnOrder []string `debugmap:"visible"`

	// SortBySubjectColumnOrder is the order of the subject columns in the schema to use
	// when sorting by subject. If unspecified, the default will be used.
	SortBySubjectColumnOrder []string `debugmap:"visible"`
}

SchemaInformation holds the schema information from the SQL datastore implementation.

func NewSchemaInformationWithOptions added in v1.40.0

func NewSchemaInformationWithOptions(opts ...SchemaInformationOption) *SchemaInformation

NewSchemaInformationWithOptions creates a new SchemaInformation with the passed in options set

func NewSchemaInformationWithOptionsAndDefaults added in v1.40.0

func NewSchemaInformationWithOptionsAndDefaults(opts ...SchemaInformationOption) *SchemaInformation

NewSchemaInformationWithOptionsAndDefaults creates a new SchemaInformation with the passed in options set starting from the defaults

func SchemaInformationWithOptions added in v1.40.0

func SchemaInformationWithOptions(s *SchemaInformation, opts ...SchemaInformationOption) *SchemaInformation

SchemaInformationWithOptions configures an existing SchemaInformation with the passed in options set

func (SchemaInformation) DebugMap added in v1.40.0

func (s SchemaInformation) DebugMap() map[string]any

DebugMap returns a map form of SchemaInformation for debugging

func (*SchemaInformation) ToOption added in v1.40.0

ToOption returns a new SchemaInformationOption that sets the values from the passed in SchemaInformation

func (*SchemaInformation) WithOptions added in v1.40.0

WithOptions configures the receiver SchemaInformation with the passed in options set

type SchemaInformationOption added in v1.40.0

type SchemaInformationOption func(s *SchemaInformation)

func SetIndexes added in v1.42.0

func SetIndexes(indexes []IndexDefinition) SchemaInformationOption

SetIndexes returns an option that can set Indexes on a SchemaInformation

func SetSortByResourceColumnOrder added in v1.43.0

func SetSortByResourceColumnOrder(sortByResourceColumnOrder []string) SchemaInformationOption

SetSortByResourceColumnOrder returns an option that can set SortByResourceColumnOrder on a SchemaInformation

func SetSortBySubjectColumnOrder added in v1.43.0

func SetSortBySubjectColumnOrder(sortBySubjectColumnOrder []string) SchemaInformationOption

SetSortBySubjectColumnOrder returns an option that can set SortBySubjectColumnOrder on a SchemaInformation

func WithColCaveatContext added in v1.40.0

func WithColCaveatContext(colCaveatContext string) SchemaInformationOption

WithColCaveatContext returns an option that can set ColCaveatContext on a SchemaInformation

func WithColCaveatName added in v1.40.0

func WithColCaveatName(colCaveatName string) SchemaInformationOption

WithColCaveatName returns an option that can set ColCaveatName on a SchemaInformation

func WithColExpiration added in v1.40.0

func WithColExpiration(colExpiration string) SchemaInformationOption

WithColExpiration returns an option that can set ColExpiration on a SchemaInformation

func WithColIntegrityHash added in v1.40.0

func WithColIntegrityHash(colIntegrityHash string) SchemaInformationOption

WithColIntegrityHash returns an option that can set ColIntegrityHash on a SchemaInformation

func WithColIntegrityKeyID added in v1.40.0

func WithColIntegrityKeyID(colIntegrityKeyID string) SchemaInformationOption

WithColIntegrityKeyID returns an option that can set ColIntegrityKeyID on a SchemaInformation

func WithColIntegrityTimestamp added in v1.40.0

func WithColIntegrityTimestamp(colIntegrityTimestamp string) SchemaInformationOption

WithColIntegrityTimestamp returns an option that can set ColIntegrityTimestamp on a SchemaInformation

func WithColNamespace added in v1.40.0

func WithColNamespace(colNamespace string) SchemaInformationOption

WithColNamespace returns an option that can set ColNamespace on a SchemaInformation

func WithColObjectID added in v1.40.0

func WithColObjectID(colObjectID string) SchemaInformationOption

WithColObjectID returns an option that can set ColObjectID on a SchemaInformation

func WithColRelation added in v1.40.0

func WithColRelation(colRelation string) SchemaInformationOption

WithColRelation returns an option that can set ColRelation on a SchemaInformation

func WithColUsersetNamespace added in v1.40.0

func WithColUsersetNamespace(colUsersetNamespace string) SchemaInformationOption

WithColUsersetNamespace returns an option that can set ColUsersetNamespace on a SchemaInformation

func WithColUsersetObjectID added in v1.40.0

func WithColUsersetObjectID(colUsersetObjectID string) SchemaInformationOption

WithColUsersetObjectID returns an option that can set ColUsersetObjectID on a SchemaInformation

func WithColUsersetRelation added in v1.40.0

func WithColUsersetRelation(colUsersetRelation string) SchemaInformationOption

WithColUsersetRelation returns an option that can set ColUsersetRelation on a SchemaInformation

func WithColumnOptimization added in v1.40.0

func WithColumnOptimization(columnOptimization ColumnOptimizationOption) SchemaInformationOption

WithColumnOptimization returns an option that can set ColumnOptimization on a SchemaInformation

func WithExpirationDisabled added in v1.40.0

func WithExpirationDisabled(expirationDisabled bool) SchemaInformationOption

WithExpirationDisabled returns an option that can set ExpirationDisabled on a SchemaInformation

func WithIndexes added in v1.42.0

func WithIndexes(indexes IndexDefinition) SchemaInformationOption

WithIndexes returns an option that can append Indexess to SchemaInformation.Indexes

func WithIntegrityEnabled added in v1.40.0

func WithIntegrityEnabled(integrityEnabled bool) SchemaInformationOption

WithIntegrityEnabled returns an option that can set IntegrityEnabled on a SchemaInformation

func WithNowFunction added in v1.40.0

func WithNowFunction(nowFunction string) SchemaInformationOption

WithNowFunction returns an option that can set NowFunction on a SchemaInformation

func WithPaginationFilterType added in v1.40.0

func WithPaginationFilterType(paginationFilterType PaginationFilterType) SchemaInformationOption

WithPaginationFilterType returns an option that can set PaginationFilterType on a SchemaInformation

func WithPlaceholderFormat added in v1.40.0

func WithPlaceholderFormat(placeholderFormat squirrel.PlaceholderFormat) SchemaInformationOption

WithPlaceholderFormat returns an option that can set PlaceholderFormat on a SchemaInformation

func WithRelationshipTableName added in v1.40.0

func WithRelationshipTableName(relationshipTableName string) SchemaInformationOption

WithRelationshipTableName returns an option that can set RelationshipTableName on a SchemaInformation

func WithSortByResourceColumnOrder added in v1.43.0

func WithSortByResourceColumnOrder(sortByResourceColumnOrder string) SchemaInformationOption

WithSortByResourceColumnOrder returns an option that can append SortByResourceColumnOrders to SchemaInformation.SortByResourceColumnOrder

func WithSortBySubjectColumnOrder added in v1.43.0

func WithSortBySubjectColumnOrder(sortBySubjectColumnOrder string) SchemaInformationOption

WithSortBySubjectColumnOrder returns an option that can append SortBySubjectColumnOrders to SchemaInformation.SortBySubjectColumnOrder

type SchemaQueryFilterer added in v1.3.0

type SchemaQueryFilterer struct {
	// contains filtered or unexported fields
}

SchemaQueryFilterer wraps a SchemaInformation and SelectBuilder to give an opinionated way to build query objects.

func NewSchemaQueryFiltererForRelationshipsSelect added in v1.40.0

func NewSchemaQueryFiltererForRelationshipsSelect(schema SchemaInformation, filterMaximumIDCount uint16, extraFields ...string) SchemaQueryFilterer

NewSchemaQueryFiltererForRelationshipsSelect creates a new SchemaQueryFilterer object for selecting relationships. This method will automatically filter the columns retrieved from the database, only selecting the columns that are not already specified with a single static value in the query.

func NewSchemaQueryFiltererWithStartingQuery added in v1.40.0

func NewSchemaQueryFiltererWithStartingQuery(schema SchemaInformation, startingQuery sq.SelectBuilder, filterMaximumIDCount uint16) SchemaQueryFilterer

NewSchemaQueryFiltererWithStartingQuery creates a new SchemaQueryFilterer object for selecting relationships, with a custom starting query. Unlike NewSchemaQueryFiltererForRelationshipsSelect, this method will not auto-filter the columns retrieved from the database.

func (SchemaQueryFilterer) After added in v1.21.0

func (SchemaQueryFilterer) FilterToRelation added in v1.3.0

func (sqf SchemaQueryFilterer) FilterToRelation(relation string) SchemaQueryFilterer

FilterToRelation returns a new SchemaQueryFilterer that is limited to resources with the specified relation.

func (SchemaQueryFilterer) FilterToResourceID added in v1.3.0

func (sqf SchemaQueryFilterer) FilterToResourceID(objectID string) SchemaQueryFilterer

FilterToResourceID returns a new SchemaQueryFilterer that is limited to resources with the specified ID.

func (SchemaQueryFilterer) FilterToResourceIDs added in v1.12.0

func (sqf SchemaQueryFilterer) FilterToResourceIDs(resourceIds []string) (SchemaQueryFilterer, error)

FilterToResourceIDs returns a new SchemaQueryFilterer that is limited to resources with any of the specified IDs.

func (SchemaQueryFilterer) FilterToResourceType added in v1.3.0

func (sqf SchemaQueryFilterer) FilterToResourceType(resourceType string) SchemaQueryFilterer

FilterToResourceType returns a new SchemaQueryFilterer that is limited to resources of the specified type.

func (SchemaQueryFilterer) FilterToSubjectFilter added in v1.3.0

func (sqf SchemaQueryFilterer) FilterToSubjectFilter(filter *v1.SubjectFilter) SchemaQueryFilterer

FilterToSubjectFilter returns a new SchemaQueryFilterer that is limited to resources with subjects that match the specified filter.

func (SchemaQueryFilterer) FilterWithCaveatName added in v1.14.0

func (sqf SchemaQueryFilterer) FilterWithCaveatName(caveatName string) SchemaQueryFilterer

FilterWithCaveatName returns a new SchemaQueryFilterer that is limited to resources with the specified caveat name.

func (SchemaQueryFilterer) FilterWithNoCaveat added in v1.43.0

func (sqf SchemaQueryFilterer) FilterWithNoCaveat() SchemaQueryFilterer

FilterWithNoCaveat returns a new SchemaQueryFilterer that is limited to resources with no caveat.

func (SchemaQueryFilterer) FilterWithRelationshipsFilter added in v1.12.0

func (sqf SchemaQueryFilterer) FilterWithRelationshipsFilter(filter datastore.RelationshipsFilter) (SchemaQueryFilterer, error)

func (SchemaQueryFilterer) FilterWithResourceIDPrefix added in v1.30.0

func (sqf SchemaQueryFilterer) FilterWithResourceIDPrefix(prefix string) (SchemaQueryFilterer, error)

FilterWithResourceIDPrefix returns new SchemaQueryFilterer that is limited to resources whose ID starts with the specified prefix.

func (SchemaQueryFilterer) FilterWithSubjectsSelectors added in v1.16.0

func (sqf SchemaQueryFilterer) FilterWithSubjectsSelectors(selectors ...datastore.SubjectsSelector) (SchemaQueryFilterer, error)

FilterWithSubjectsSelectors returns a new SchemaQueryFilterer that is limited to resources with subjects that match the specified selector(s).

func (SchemaQueryFilterer) MustAfter added in v1.43.0

func (SchemaQueryFilterer) MustFilterToResourceIDs added in v1.16.0

func (sqf SchemaQueryFilterer) MustFilterToResourceIDs(resourceIds []string) SchemaQueryFilterer

func (SchemaQueryFilterer) MustFilterWithRelationshipsFilter added in v1.16.0

func (sqf SchemaQueryFilterer) MustFilterWithRelationshipsFilter(filter datastore.RelationshipsFilter) SchemaQueryFilterer

MustFilterWithRelationshipsFilter returns a new SchemaQueryFilterer that is limited to resources with resources that match the specified filter.

func (SchemaQueryFilterer) MustFilterWithResourceIDPrefix added in v1.30.0

func (sqf SchemaQueryFilterer) MustFilterWithResourceIDPrefix(prefix string) SchemaQueryFilterer

func (SchemaQueryFilterer) MustFilterWithSubjectsSelectors added in v1.16.0

func (sqf SchemaQueryFilterer) MustFilterWithSubjectsSelectors(selectors ...datastore.SubjectsSelector) SchemaQueryFilterer

MustFilterWithSubjectsSelectors returns a new SchemaQueryFilterer that is limited to resources with subjects that match the specified selector(s).

func (SchemaQueryFilterer) TupleOrder added in v1.21.0

func (SchemaQueryFilterer) UnderlyingQueryBuilder added in v1.34.0

func (sqf SchemaQueryFilterer) UnderlyingQueryBuilder() sq.SelectBuilder

func (SchemaQueryFilterer) WithAdditionalFilter added in v1.40.0

func (sqf SchemaQueryFilterer) WithAdditionalFilter(filter func(original sq.SelectBuilder) sq.SelectBuilder) SchemaQueryFilterer

WithAdditionalFilter returns the SchemaQueryFilterer with an additional filter applied to the query.

func (SchemaQueryFilterer) WithFromSuffix added in v1.40.0

func (sqf SchemaQueryFilterer) WithFromSuffix(fromSuffix string) SchemaQueryFilterer

WithFromSuffix returns the SchemaQueryFilterer with a suffix added to the FROM clause.

func (SchemaQueryFilterer) WithFromTable added in v1.43.0

func (sqf SchemaQueryFilterer) WithFromTable(fromTable string) SchemaQueryFilterer

WithFromTable returns the SchemaQueryFilterer with a custom FROM table.

func (SchemaQueryFilterer) WithIndexingHint added in v1.43.0

func (sqf SchemaQueryFilterer) WithIndexingHint(indexingHint IndexingHint) SchemaQueryFilterer

WithIndexingHint returns the SchemaQueryFilterer with an indexing hint applied to the query.

type SerializationError added in v1.26.0

type SerializationError struct {
	// contains filtered or unexported fields
}

SerializationError is returned when there's been a serialization error while performing a datastore operation

func (SerializationError) GRPCStatus added in v1.26.0

func (err SerializationError) GRPCStatus() *status.Status

func (SerializationError) Unwrap added in v1.26.0

func (err SerializationError) Unwrap() error

type WriteOverLimitError added in v1.45.2

type WriteOverLimitError struct {
	// contains filtered or unexported fields
}

func (WriteOverLimitError) GRPCStatus added in v1.45.2

func (err WriteOverLimitError) GRPCStatus() *status.Status

func (WriteOverLimitError) Unwrap added in v1.45.2

func (err WriteOverLimitError) Unwrap() error

Jump to

Keyboard shortcuts

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