intercept

package
v0.0.0-...-e368738 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminFunc

type AdminFunc func(context.Context, *ent.AdminQuery) (ent.Value, error)

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

func (AdminFunc) Query

func (f AdminFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error)

Query calls f(ctx, q).

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 ent.Querier) ent.Querier

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

type PermissionFunc

type PermissionFunc func(context.Context, *ent.PermissionQuery) (ent.Value, error)

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

func (PermissionFunc) Query

func (f PermissionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error)

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 ent.Query) (Query, error)

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

type RoleFunc

type RoleFunc func(context.Context, *ent.RoleQuery) (ent.Value, error)

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

func (RoleFunc) Query

func (f RoleFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error)

Query calls f(ctx, q).

type RouteFunc

type RouteFunc func(context.Context, *ent.RouteQuery) (ent.Value, error)

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

func (RouteFunc) Query

func (f RouteFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error)

Query calls f(ctx, q).

type TraverseAdmin

type TraverseAdmin func(context.Context, *ent.AdminQuery) error

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

func (TraverseAdmin) Intercept

func (f TraverseAdmin) Intercept(next ent.Querier) ent.Querier

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

func (TraverseAdmin) Traverse

func (f TraverseAdmin) Traverse(ctx context.Context, q ent.Query) error

Traverse calls f(ctx, q).

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 ent.Querier) ent.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 ent.Query) error

Traverse calls f(ctx, q).

type TraversePermission

type TraversePermission func(context.Context, *ent.PermissionQuery) error

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

func (TraversePermission) Intercept

func (f TraversePermission) Intercept(next ent.Querier) ent.Querier

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

func (TraversePermission) Traverse

func (f TraversePermission) Traverse(ctx context.Context, q ent.Query) error

Traverse calls f(ctx, q).

type TraverseRole

type TraverseRole func(context.Context, *ent.RoleQuery) error

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

func (TraverseRole) Intercept

func (f TraverseRole) Intercept(next ent.Querier) ent.Querier

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

func (TraverseRole) Traverse

func (f TraverseRole) Traverse(ctx context.Context, q ent.Query) error

Traverse calls f(ctx, q).

type TraverseRoute

type TraverseRoute func(context.Context, *ent.RouteQuery) error

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

func (TraverseRoute) Intercept

func (f TraverseRoute) Intercept(next ent.Querier) ent.Querier

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

func (TraverseRoute) Traverse

func (f TraverseRoute) Traverse(ctx context.Context, q ent.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