intercept

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(context.Context, Query) error

The Func type is an adapter that allows ordinary functions to be used as interceptors. Unlike traversal functions, interceptors are skipped during graph traversals. Note that the implementation of Func is different from the one defined in entgo.io/ent.InterceptFunc.

func (Func) Intercept

func (f Func) Intercept(next generated.Querier) generated.Querier

Intercept calls f(ctx, q) and then applied the next Querier.

type LoadBalancerFunc

type LoadBalancerFunc func(context.Context, *generated.LoadBalancerQuery) (generated.Value, error)

The LoadBalancerFunc type is an adapter to allow the use of ordinary function as a Querier.

func (LoadBalancerFunc) Query

Query calls f(ctx, q).

type OriginFunc

The OriginFunc type is an adapter to allow the use of ordinary function as a Querier.

func (OriginFunc) Query

Query calls f(ctx, q).

type PoolFunc

The PoolFunc type is an adapter to allow the use of ordinary function as a Querier.

func (PoolFunc) Query

Query calls f(ctx, q).

type PortFunc

The PortFunc type is an adapter to allow the use of ordinary function as a Querier.

func (PortFunc) Query

Query calls f(ctx, q).

type ProviderFunc

type ProviderFunc func(context.Context, *generated.ProviderQuery) (generated.Value, error)

The ProviderFunc type is an adapter to allow the use of ordinary function as a Querier.

func (ProviderFunc) Query

Query calls f(ctx, q).

type Query

type Query interface {
	// Type returns the string representation of the query type.
	Type() string
	// Limit the number of records to be returned by this query.
	Limit(int)
	// Offset to start from.
	Offset(int)
	// Unique configures the query builder to filter duplicate records.
	Unique(bool)
	// Order specifies how the records should be ordered.
	Order(...func(*sql.Selector))
	// WhereP appends storage-level predicates to the query builder. Using this method, users
	// can use type-assertion to append predicates that do not depend on any generated package.
	WhereP(...func(*sql.Selector))
}

The Query interface represents an operation that queries a graph. By using this interface, users can write generic code that manipulates query builders of different types.

func NewQuery

func NewQuery(q generated.Query) (Query, error)

NewQuery returns the generic Query interface for the given typed query.

type TraverseFunc

type TraverseFunc func(context.Context, Query) error

The TraverseFunc type is an adapter to allow the use of ordinary function as Traverser. If f is a function with the appropriate signature, TraverseFunc(f) is a Traverser that calls f.

func (TraverseFunc) Intercept

func (f TraverseFunc) Intercept(next generated.Querier) generated.Querier

Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.

func (TraverseFunc) Traverse

func (f TraverseFunc) Traverse(ctx context.Context, q generated.Query) error

Traverse calls f(ctx, q).

type TraverseLoadBalancer

type TraverseLoadBalancer func(context.Context, *generated.LoadBalancerQuery) error

The TraverseLoadBalancer type is an adapter to allow the use of ordinary function as Traverser.

func (TraverseLoadBalancer) Intercept

Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.

func (TraverseLoadBalancer) Traverse

Traverse calls f(ctx, q).

type TraverseOrigin

type TraverseOrigin func(context.Context, *generated.OriginQuery) error

The TraverseOrigin type is an adapter to allow the use of ordinary function as Traverser.

func (TraverseOrigin) Intercept

func (f TraverseOrigin) Intercept(next generated.Querier) generated.Querier

Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.

func (TraverseOrigin) Traverse

func (f TraverseOrigin) Traverse(ctx context.Context, q generated.Query) error

Traverse calls f(ctx, q).

type TraversePool

type TraversePool func(context.Context, *generated.PoolQuery) error

The TraversePool type is an adapter to allow the use of ordinary function as Traverser.

func (TraversePool) Intercept

func (f TraversePool) Intercept(next generated.Querier) generated.Querier

Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.

func (TraversePool) Traverse

func (f TraversePool) Traverse(ctx context.Context, q generated.Query) error

Traverse calls f(ctx, q).

type TraversePort

type TraversePort func(context.Context, *generated.PortQuery) error

The TraversePort type is an adapter to allow the use of ordinary function as Traverser.

func (TraversePort) Intercept

func (f TraversePort) Intercept(next generated.Querier) generated.Querier

Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.

func (TraversePort) Traverse

func (f TraversePort) Traverse(ctx context.Context, q generated.Query) error

Traverse calls f(ctx, q).

type TraverseProvider

type TraverseProvider func(context.Context, *generated.ProviderQuery) error

The TraverseProvider type is an adapter to allow the use of ordinary function as Traverser.

func (TraverseProvider) Intercept

Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.

func (TraverseProvider) Traverse

func (f TraverseProvider) Traverse(ctx context.Context, q generated.Query) error

Traverse calls f(ctx, q).

Jump to

Keyboard shortcuts

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