hook

package
v0.0.0-...-444ad2e Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func On

func On(hk ent.Hook, op ent.Op) ent.Hook

On executes the given hook only of the given operation.

hook.On(Log, ent.Delete|ent.Create)

func Reject

func Reject(op ent.Op) ent.Hook

Reject returns a hook that rejects all operations that match op.

func (T) Hooks() []ent.Hook {
	return []ent.Hook{
		Reject(ent.Delete|ent.Update),
	}
}

Types

type AccountFunc

type AccountFunc func(context.Context, *ent.AccountMutation) (ent.Value, error)

The AccountFunc type is an adapter to allow the use of ordinary function as Account mutator.

func (AccountFunc) Mutate

func (f AccountFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type AnswerFunc

type AnswerFunc func(context.Context, *ent.AnswerMutation) (ent.Value, error)

The AnswerFunc type is an adapter to allow the use of ordinary function as Answer mutator.

func (AnswerFunc) Mutate

func (f AnswerFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type Chain

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

Chain acts as a list of hooks and is effectively immutable. Once created, it will always hold the same set of hooks in the same order.

func NewChain

func NewChain(hooks ...ent.Hook) Chain

NewChain creates a new chain of hooks.

func (Chain) Append

func (c Chain) Append(hooks ...ent.Hook) Chain

Append extends a chain, adding the specified hook as the last ones in the mutation flow.

func (Chain) Extend

func (c Chain) Extend(chain Chain) Chain

Extend extends a chain, adding the specified chain as the last ones in the mutation flow.

func (Chain) Hook

func (c Chain) Hook() ent.Hook

Hook chains the list of hooks and returns the final hook.

type ContactFunc

type ContactFunc func(context.Context, *ent.ContactMutation) (ent.Value, error)

The ContactFunc type is an adapter to allow the use of ordinary function as Contact mutator.

func (ContactFunc) Mutate

func (f ContactFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type DeviceFunc

type DeviceFunc func(context.Context, *ent.DeviceMutation) (ent.Value, error)

The DeviceFunc type is an adapter to allow the use of ordinary function as Device mutator.

func (DeviceFunc) Mutate

func (f DeviceFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type DomainFunc

type DomainFunc func(context.Context, *ent.DomainMutation) (ent.Value, error)

The DomainFunc type is an adapter to allow the use of ordinary function as Domain mutator.

func (DomainFunc) Mutate

func (f DomainFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type FlowFunc

type FlowFunc func(context.Context, *ent.FlowMutation) (ent.Value, error)

The FlowFunc type is an adapter to allow the use of ordinary function as Flow mutator.

func (FlowFunc) Mutate

func (f FlowFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type IPFunc

type IPFunc func(context.Context, *ent.IPMutation) (ent.Value, error)

The IPFunc type is an adapter to allow the use of ordinary function as IP mutator.

func (IPFunc) Mutate

func (f IPFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type InputFunc

type InputFunc func(context.Context, *ent.InputMutation) (ent.Value, error)

The InputFunc type is an adapter to allow the use of ordinary function as Input mutator.

func (InputFunc) Mutate

func (f InputFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type PersonFunc

type PersonFunc func(context.Context, *ent.PersonMutation) (ent.Value, error)

The PersonFunc type is an adapter to allow the use of ordinary function as Person mutator.

func (PersonFunc) Mutate

func (f PersonFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type QuestionFunc

type QuestionFunc func(context.Context, *ent.QuestionMutation) (ent.Value, error)

The QuestionFunc type is an adapter to allow the use of ordinary function as Question mutator.

func (QuestionFunc) Mutate

func (f QuestionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type ShortFunc

type ShortFunc func(context.Context, *ent.ShortMutation) (ent.Value, error)

The ShortFunc type is an adapter to allow the use of ordinary function as Short mutator.

func (ShortFunc) Mutate

func (f ShortFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

type SurveyFunc

type SurveyFunc func(context.Context, *ent.SurveyMutation) (ent.Value, error)

The SurveyFunc type is an adapter to allow the use of ordinary function as Survey mutator.

func (SurveyFunc) Mutate

func (f SurveyFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error)

Mutate calls f(ctx, m).

Jump to

Keyboard shortcuts

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