hook

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: Apache-2.0 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 Chain added in v0.1.5

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 added in v0.1.5

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

NewChain creates a new chain of hooks.

func (Chain) Append added in v0.1.5

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 added in v0.1.5

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 added in v0.1.5

func (c Chain) Hook() ent.Hook

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

type GalaxyFunc added in v0.1.5

type GalaxyFunc func(context.Context, *ent.GalaxyMutation) (ent.Value, error)

The GalaxyFunc type is an adapter to allow the use of ordinary function as Galaxy mutator.

func (GalaxyFunc) Mutate added in v0.1.5

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

Mutate calls f(ctx, m).

type PlanetFunc

type PlanetFunc func(context.Context, *ent.PlanetMutation) (ent.Value, error)

The PlanetFunc type is an adapter to allow the use of ordinary function as Planet mutator.

func (PlanetFunc) Mutate

func (f PlanetFunc) 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