options

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

View Source
var (

	// LimitOne is a constant *uint64 that can be used with WithLimit requests.
	LimitOne = &one
)

Functions

func ToRelationship added in v1.39.0

func ToRelationship(c Cursor) *tuple.Relationship

Types

type Cursor

type Cursor *tuple.Relationship

func ToCursor added in v1.39.0

func ToCursor(r tuple.Relationship) Cursor

type DeleteOptions added in v1.30.0

type DeleteOptions struct {
	DeleteLimit *uint64 `debugmap:"visible"`
}

DeleteOptions are the options that can affect the results of a delete relationships operation.

func DeleteOptionsWithOptions added in v1.30.0

func DeleteOptionsWithOptions(d *DeleteOptions, opts ...DeleteOptionsOption) *DeleteOptions

DeleteOptionsWithOptions configures an existing DeleteOptions with the passed in options set

func NewDeleteOptionsWithOptions added in v1.30.0

func NewDeleteOptionsWithOptions(opts ...DeleteOptionsOption) *DeleteOptions

NewDeleteOptionsWithOptions creates a new DeleteOptions with the passed in options set

func NewDeleteOptionsWithOptionsAndDefaults added in v1.30.0

func NewDeleteOptionsWithOptionsAndDefaults(opts ...DeleteOptionsOption) *DeleteOptions

NewDeleteOptionsWithOptionsAndDefaults creates a new DeleteOptions with the passed in options set starting from the defaults

func (DeleteOptions) DebugMap added in v1.30.0

func (d DeleteOptions) DebugMap() map[string]any

DebugMap returns a map form of DeleteOptions for debugging

func (*DeleteOptions) ToOption added in v1.30.0

func (d *DeleteOptions) ToOption() DeleteOptionsOption

ToOption returns a new DeleteOptionsOption that sets the values from the passed in DeleteOptions

func (*DeleteOptions) WithOptions added in v1.30.0

func (d *DeleteOptions) WithOptions(opts ...DeleteOptionsOption) *DeleteOptions

WithOptions configures the receiver DeleteOptions with the passed in options set

type DeleteOptionsOption added in v1.30.0

type DeleteOptionsOption func(d *DeleteOptions)

func WithDeleteLimit added in v1.30.0

func WithDeleteLimit(deleteLimit *uint64) DeleteOptionsOption

WithDeleteLimit returns an option that can set DeleteLimit on a DeleteOptions

type QueryOptions

type QueryOptions struct {
	Limit          *uint64   `debugmap:"visible"`
	Sort           SortOrder `debugmap:"visible"`
	After          Cursor    `debugmap:"visible"`
	SkipCaveats    bool      `debugmap:"visible"`
	SkipExpiration bool      `debugmap:"visible"`

	// SQLCheckAssertionForTest is a function that can be used to assert a condition on the SQL query string.
	// For testing and validation only.
	SQLCheckAssertionForTest SQLCheckAssertionForTest `debugmap:"visible"`

	// SQLExplainCallbackForTest is a callback invoked with the explain plan of the SQL query string.
	// For testing and validation only.
	SQLExplainCallbackForTest SQLExplainCallbackForTest `debugmap:"visible"`

	// QueryShape is the marked shape of the query.
	// For testing and validation only.
	QueryShape queryshape.Shape `debugmap:"visible"`
}

QueryOptions are the options that can affect the results of a normal forward query.

func NewQueryOptionsWithOptions

func NewQueryOptionsWithOptions(opts ...QueryOptionsOption) *QueryOptions

NewQueryOptionsWithOptions creates a new QueryOptions with the passed in options set

func NewQueryOptionsWithOptionsAndDefaults added in v1.22.0

func NewQueryOptionsWithOptionsAndDefaults(opts ...QueryOptionsOption) *QueryOptions

NewQueryOptionsWithOptionsAndDefaults creates a new QueryOptions with the passed in options set starting from the defaults

func QueryOptionsWithOptions

func QueryOptionsWithOptions(q *QueryOptions, opts ...QueryOptionsOption) *QueryOptions

QueryOptionsWithOptions configures an existing QueryOptions with the passed in options set

func (QueryOptions) DebugMap added in v1.22.0

func (q QueryOptions) DebugMap() map[string]any

DebugMap returns a map form of QueryOptions for debugging

func (*QueryOptions) ToOption

func (q *QueryOptions) ToOption() QueryOptionsOption

ToOption returns a new QueryOptionsOption that sets the values from the passed in QueryOptions

func (*QueryOptions) WithOptions added in v1.22.0

func (q *QueryOptions) WithOptions(opts ...QueryOptionsOption) *QueryOptions

WithOptions configures the receiver QueryOptions with the passed in options set

type QueryOptionsOption

type QueryOptionsOption func(q *QueryOptions)

func WithAfter

func WithAfter(after Cursor) QueryOptionsOption

WithAfter returns an option that can set After on a QueryOptions

func WithLimit

func WithLimit(limit *uint64) QueryOptionsOption

WithLimit returns an option that can set Limit on a QueryOptions

func WithQueryShape added in v1.42.0

func WithQueryShape(queryShape queryshape.Shape) QueryOptionsOption

WithQueryShape returns an option that can set QueryShape on a QueryOptions

func WithSQLCheckAssertionForTest added in v1.42.0

func WithSQLCheckAssertionForTest(sQLCheckAssertionForTest SQLCheckAssertionForTest) QueryOptionsOption

WithSQLCheckAssertionForTest returns an option that can set SQLCheckAssertionForTest on a QueryOptions

func WithSQLExplainCallbackForTest added in v1.42.0

func WithSQLExplainCallbackForTest(sQLExplainCallbackForTest SQLExplainCallbackForTest) QueryOptionsOption

WithSQLExplainCallbackForTest returns an option that can set SQLExplainCallbackForTest on a QueryOptions

func WithSkipCaveats added in v1.40.0

func WithSkipCaveats(skipCaveats bool) QueryOptionsOption

WithSkipCaveats returns an option that can set SkipCaveats on a QueryOptions

func WithSkipExpiration added in v1.40.0

func WithSkipExpiration(skipExpiration bool) QueryOptionsOption

WithSkipExpiration returns an option that can set SkipExpiration on a QueryOptions

func WithSort

func WithSort(sort SortOrder) QueryOptionsOption

WithSort returns an option that can set Sort on a QueryOptions

type RWTOptions added in v1.22.0

type RWTOptions struct {
	DisableRetries    bool             `debugmap:"visible"`
	Metadata          *structpb.Struct `debugmap:"visible"`
	IncludesExpiredAt bool             `debugmap:"visible"`
}

RWTOptions are options that can affect the way a read-write transaction is executed.

func NewRWTOptionsWithOptions added in v1.22.0

func NewRWTOptionsWithOptions(opts ...RWTOptionsOption) *RWTOptions

NewRWTOptionsWithOptions creates a new RWTOptions with the passed in options set

func NewRWTOptionsWithOptionsAndDefaults added in v1.22.0

func NewRWTOptionsWithOptionsAndDefaults(opts ...RWTOptionsOption) *RWTOptions

NewRWTOptionsWithOptionsAndDefaults creates a new RWTOptions with the passed in options set starting from the defaults

func RWTOptionsWithOptions added in v1.22.0

func RWTOptionsWithOptions(r *RWTOptions, opts ...RWTOptionsOption) *RWTOptions

RWTOptionsWithOptions configures an existing RWTOptions with the passed in options set

func (RWTOptions) DebugMap added in v1.22.0

func (r RWTOptions) DebugMap() map[string]any

DebugMap returns a map form of RWTOptions for debugging

func (*RWTOptions) ToOption added in v1.22.0

func (r *RWTOptions) ToOption() RWTOptionsOption

ToOption returns a new RWTOptionsOption that sets the values from the passed in RWTOptions

func (*RWTOptions) WithOptions added in v1.22.0

func (r *RWTOptions) WithOptions(opts ...RWTOptionsOption) *RWTOptions

WithOptions configures the receiver RWTOptions with the passed in options set

type RWTOptionsOption added in v1.22.0

type RWTOptionsOption func(r *RWTOptions)

func WithDisableRetries added in v1.22.0

func WithDisableRetries(disableRetries bool) RWTOptionsOption

WithDisableRetries returns an option that can set DisableRetries on a RWTOptions

func WithIncludesExpiredAt added in v1.46.1

func WithIncludesExpiredAt(includesExpiredAt bool) RWTOptionsOption

WithIncludesExpiredAt returns an option that can set IncludesExpiredAt on a RWTOptions

func WithMetadata added in v1.38.0

func WithMetadata(metadata *structpb.Struct) RWTOptionsOption

WithMetadata returns an option that can set Metadata on a RWTOptions

type ResourceRelation

type ResourceRelation struct {
	Namespace string
	Relation  string
}

ResourceRelation combines a resource object type and relation.

type ReverseQueryOptions

type ReverseQueryOptions struct {
	ResRelation *ResourceRelation `debugmap:"visible"`

	LimitForReverse          *uint64   `debugmap:"visible"`
	SortForReverse           SortOrder `debugmap:"visible"`
	AfterForReverse          Cursor    `debugmap:"visible"`
	SkipCaveatsForReverse    bool      `debugmap:"visible"`
	SkipExpirationForReverse bool      `debugmap:"visible"`

	// SQLExplainCallbackForTestForReverse is a callback invoked with the explain plan of the SQL query string.
	// For testing and validation only.
	SQLExplainCallbackForTestForReverse SQLExplainCallbackForTest `debugmap:"visible"`

	// QueryShapeForReverse is the marked shape of the reverse query.
	// For testing and validation only.
	QueryShapeForReverse queryshape.Shape `debugmap:"visible"`
}

ReverseQueryOptions are the options that can affect the results of a reverse query.

func NewReverseQueryOptionsWithOptions

func NewReverseQueryOptionsWithOptions(opts ...ReverseQueryOptionsOption) *ReverseQueryOptions

NewReverseQueryOptionsWithOptions creates a new ReverseQueryOptions with the passed in options set

func NewReverseQueryOptionsWithOptionsAndDefaults added in v1.22.0

func NewReverseQueryOptionsWithOptionsAndDefaults(opts ...ReverseQueryOptionsOption) *ReverseQueryOptions

NewReverseQueryOptionsWithOptionsAndDefaults creates a new ReverseQueryOptions with the passed in options set starting from the defaults

func ReverseQueryOptionsWithOptions

func ReverseQueryOptionsWithOptions(r *ReverseQueryOptions, opts ...ReverseQueryOptionsOption) *ReverseQueryOptions

ReverseQueryOptionsWithOptions configures an existing ReverseQueryOptions with the passed in options set

func (ReverseQueryOptions) DebugMap added in v1.22.0

func (r ReverseQueryOptions) DebugMap() map[string]any

DebugMap returns a map form of ReverseQueryOptions for debugging

func (*ReverseQueryOptions) ToOption

ToOption returns a new ReverseQueryOptionsOption that sets the values from the passed in ReverseQueryOptions

func (*ReverseQueryOptions) WithOptions added in v1.22.0

WithOptions configures the receiver ReverseQueryOptions with the passed in options set

type ReverseQueryOptionsOption

type ReverseQueryOptionsOption func(r *ReverseQueryOptions)

func WithAfterForReverse

func WithAfterForReverse(afterForReverse Cursor) ReverseQueryOptionsOption

WithAfterForReverse returns an option that can set AfterForReverse on a ReverseQueryOptions

func WithLimitForReverse

func WithLimitForReverse(limitForReverse *uint64) ReverseQueryOptionsOption

WithLimitForReverse returns an option that can set LimitForReverse on a ReverseQueryOptions

func WithQueryShapeForReverse added in v1.42.0

func WithQueryShapeForReverse(queryShapeForReverse queryshape.Shape) ReverseQueryOptionsOption

WithQueryShapeForReverse returns an option that can set QueryShapeForReverse on a ReverseQueryOptions

func WithResRelation

func WithResRelation(resRelation *ResourceRelation) ReverseQueryOptionsOption

WithResRelation returns an option that can set ResRelation on a ReverseQueryOptions

func WithSQLExplainCallbackForTestForReverse added in v1.42.0

func WithSQLExplainCallbackForTestForReverse(sQLExplainCallbackForTestForReverse SQLExplainCallbackForTest) ReverseQueryOptionsOption

WithSQLExplainCallbackForTestForReverse returns an option that can set SQLExplainCallbackForTestForReverse on a ReverseQueryOptions

func WithSkipCaveatsForReverse added in v1.44.4

func WithSkipCaveatsForReverse(skipCaveatsForReverse bool) ReverseQueryOptionsOption

WithSkipCaveatsForReverse returns an option that can set SkipCaveatsForReverse on a ReverseQueryOptions

func WithSkipExpirationForReverse added in v1.44.4

func WithSkipExpirationForReverse(skipExpirationForReverse bool) ReverseQueryOptionsOption

WithSkipExpirationForReverse returns an option that can set SkipExpirationForReverse on a ReverseQueryOptions

func WithSortForReverse

func WithSortForReverse(sortForReverse SortOrder) ReverseQueryOptionsOption

WithSortForReverse returns an option that can set SortForReverse on a ReverseQueryOptions

type SQLCheckAssertionForTest added in v1.42.0

type SQLCheckAssertionForTest func(sql string)

SQLCheckAssertionForTest is a function that can be used to assert a condition on the SQL query string. Assertions will only be run during testing and only apply in datastores that support SQL.

type SQLExplainCallbackForTest added in v1.42.0

type SQLExplainCallbackForTest func(ctx context.Context, sql string, args []any, shape queryshape.Shape, explain string, expectedIndexes SQLIndexInformation) error

SQLExplainCallbackForTest is a callback invoked with the explain plan of the SQL query string.

type SQLIndexInformation added in v1.42.0

type SQLIndexInformation struct {
	// ExpectedIndexNames are the name(s) of the index(es) that are expected to be used by this
	// SQL query.
	ExpectedIndexNames []string
}

SQLIndexInformation holds the expected index names for a SQL query.

type SortOrder

type SortOrder int8

SortOrder is an enum which represents the order in which the caller would like the data returned.

const (
	// Unsorted lets the underlying datastore choose the order, or no order at all
	Unsorted SortOrder = iota

	// ByResource sorts the relationships by the resource component first
	ByResource

	// BySubject sorts the relationships by the subject component first. Note that
	// BySubject might be quite a bit slower than ByResource, as relationships are
	// indexed by resource.
	BySubject

	// ChooseEfficient lets the datastore choose the most efficient order based on the query shape and available indexes.
	ChooseEfficient
)

Jump to

Keyboard shortcuts

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