hook

package
v0.0.0-...-8064f01 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixedError

func FixedError(err error) ent.Hook

FixedError is a hook returning a fixed error.

func If

func If(hk ent.Hook, cond Condition) ent.Hook

If executes the given hook under condition.

hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))

func On

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

On executes the given hook only for 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),
	}
}

func Unless

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

Unless skips the given hook only for the given operation.

hook.Unless(Log, ent.Update|ent.UpdateOne)

Types

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 Condition

type Condition func(context.Context, ent.Mutation) bool

Condition is a hook condition function.

func And

func And(first, second Condition, rest ...Condition) Condition

And groups conditions with the AND operator.

func HasAddedFields

func HasAddedFields(field string, fields ...string) Condition

HasAddedFields is a condition validating `.AddedField` on fields.

func HasClearedFields

func HasClearedFields(field string, fields ...string) Condition

HasClearedFields is a condition validating `.FieldCleared` on fields.

func HasFields

func HasFields(field string, fields ...string) Condition

HasFields is a condition validating `.Field` on fields.

func HasOp

func HasOp(op ent.Op) Condition

HasOp is a condition testing mutation operation.

func Not

func Not(cond Condition) Condition

Not negates a given condition.

func Or

func Or(first, second Condition, rest ...Condition) Condition

Or groups conditions with the OR operator.

type Rent591HomeDetailBreadcrumbFunc

type Rent591HomeDetailBreadcrumbFunc func(context.Context, *ent.Rent591HomeDetailBreadcrumbMutation) (ent.Value, error)

The Rent591HomeDetailBreadcrumbFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailBreadcrumb mutator.

func (Rent591HomeDetailBreadcrumbFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailBrowseFunc

type Rent591HomeDetailBrowseFunc func(context.Context, *ent.Rent591HomeDetailBrowseMutation) (ent.Value, error)

The Rent591HomeDetailBrowseFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailBrowse mutator.

func (Rent591HomeDetailBrowseFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailFunc

type Rent591HomeDetailFunc func(context.Context, *ent.Rent591HomeDetailMutation) (ent.Value, error)

The Rent591HomeDetailFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetail mutator.

func (Rent591HomeDetailFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailInfoFunc

type Rent591HomeDetailInfoFunc func(context.Context, *ent.Rent591HomeDetailInfoMutation) (ent.Value, error)

The Rent591HomeDetailInfoFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailInfo mutator.

func (Rent591HomeDetailInfoFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailNavDataFunc

type Rent591HomeDetailNavDataFunc func(context.Context, *ent.Rent591HomeDetailNavDataMutation) (ent.Value, error)

The Rent591HomeDetailNavDataFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailNavData mutator.

func (Rent591HomeDetailNavDataFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailPositionRoundDataChildrenFunc

type Rent591HomeDetailPositionRoundDataChildrenFunc func(context.Context, *ent.Rent591HomeDetailPositionRoundDataChildrenMutation) (ent.Value, error)

The Rent591HomeDetailPositionRoundDataChildrenFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailPositionRoundDataChildren mutator.

func (Rent591HomeDetailPositionRoundDataChildrenFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailPositionRoundDataFunc

type Rent591HomeDetailPositionRoundDataFunc func(context.Context, *ent.Rent591HomeDetailPositionRoundDataMutation) (ent.Value, error)

The Rent591HomeDetailPositionRoundDataFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailPositionRoundData mutator.

func (Rent591HomeDetailPositionRoundDataFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailPositionRoundFunc

type Rent591HomeDetailPositionRoundFunc func(context.Context, *ent.Rent591HomeDetailPositionRoundMutation) (ent.Value, error)

The Rent591HomeDetailPositionRoundFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailPositionRound mutator.

func (Rent591HomeDetailPositionRoundFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailPublishFunc

type Rent591HomeDetailPublishFunc func(context.Context, *ent.Rent591HomeDetailPublishMutation) (ent.Value, error)

The Rent591HomeDetailPublishFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailPublish mutator.

func (Rent591HomeDetailPublishFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailShareInfoFunc

type Rent591HomeDetailShareInfoFunc func(context.Context, *ent.Rent591HomeDetailShareInfoMutation) (ent.Value, error)

The Rent591HomeDetailShareInfoFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailShareInfo mutator.

func (Rent591HomeDetailShareInfoFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeDetailTagFunc

type Rent591HomeDetailTagFunc func(context.Context, *ent.Rent591HomeDetailTagMutation) (ent.Value, error)

The Rent591HomeDetailTagFunc type is an adapter to allow the use of ordinary function as Rent591HomeDetailTag mutator.

func (Rent591HomeDetailTagFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeFunc

type Rent591HomeFunc func(context.Context, *ent.Rent591HomeMutation) (ent.Value, error)

The Rent591HomeFunc type is an adapter to allow the use of ordinary function as Rent591Home mutator.

func (Rent591HomeFunc) Mutate

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

Mutate calls f(ctx, m).

type Rent591HomeSurroundingFunc

type Rent591HomeSurroundingFunc func(context.Context, *ent.Rent591HomeSurroundingMutation) (ent.Value, error)

The Rent591HomeSurroundingFunc type is an adapter to allow the use of ordinary function as Rent591HomeSurrounding mutator.

func (Rent591HomeSurroundingFunc) Mutate

Mutate calls f(ctx, m).

type Rent591HomeTagFunc

type Rent591HomeTagFunc func(context.Context, *ent.Rent591HomeTagMutation) (ent.Value, error)

The Rent591HomeTagFunc type is an adapter to allow the use of ordinary function as Rent591HomeTag mutator.

func (Rent591HomeTagFunc) Mutate

Mutate calls f(ctx, m).

Jump to

Keyboard shortcuts

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