mixin

package
v1.2.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithSoftDeleted

func WithSoftDeleted(parent context.Context) context.Context

WithSoftDeleted returns a new context that skips the soft-delete interceptor/mutators.

Types

type MutateFunc

type MutateFunc struct {
	MutationMutatorFunc func(m ent.Mutation) ent.Mutator                             //func(ent.Query) (Query, error)
	Mutator             func(ctx context.Context, m ent.Mutation) (ent.Value, error) // func(next ent.Mutator) ent.Mutator
}

func (MutateFunc) Mutate

func (m MutateFunc) Mutate(ctx context.Context, mutation ent.Mutation) (ent.Value, error)

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.

type TimeMixin

type TimeMixin struct {
	// We embed the `mixin.Schema` to avoid
	// implementing the rest of the methods.
	mixin.Schema
	InterceptorNewQueryFunc func(query ent.Query) (any, error)
	MutationMutatorFunc     func(mutation ent.Mutation) ent.Mutator
}

func (TimeMixin) Fields

func (TimeMixin) Fields() []ent.Field

func (TimeMixin) Hooks

func (d TimeMixin) Hooks() []ent.Hook

Hooks of the SoftDeleteMixin.

func (TimeMixin) Interceptors

func (d TimeMixin) Interceptors() []ent.Interceptor

Interceptors of the SoftDeleteMixin.

func (TimeMixin) P

func (d TimeMixin) P(w interface{ WhereP(...func(*sql.Selector)) })

P adds a storage-level predicate to the queries and mutations.

type TraverseFunc

type TraverseFunc struct {
	InterceptorNewQueryFunc func(query ent.Query) (any, error) //func(ent.Query) (Query, error)
	Interceptor             func(context.Context, Query) error
}

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

Jump to

Keyboard shortcuts

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