hook

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func On

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

On executes the given hook only of the given operation.

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

func Reject

func Reject(op entv1.Op) ent.Hook

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

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

Types

type CarFunc

type CarFunc func(context.Context, *entv1.CarMutation) (entv1.Value, error)

The CarFunc type is an adapter to allow the use of ordinary function as Car mutator.

func (CarFunc) Mutate

func (f CarFunc) Mutate(ctx context.Context, m entv1.Mutation) (entv1.Value, error)

Mutate calls f(ctx, m).

type UserFunc

type UserFunc func(context.Context, *entv1.UserMutation) (entv1.Value, error)

The UserFunc type is an adapter to allow the use of ordinary function as User mutator.

func (UserFunc) Mutate

func (f UserFunc) Mutate(ctx context.Context, m entv1.Mutation) (entv1.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