hook

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 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) generated.Hook

FixedError is a hook returning a fixed error.

func If

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

If executes the given hook under condition.

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

func On

On executes the given hook only for the given operation.

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

func Reject

func Reject(op generated.Op) generated.Hook

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

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

func Unless

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

Unless skips the given hook only for the given operation.

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

Types

type APITokenFunc

The APITokenFunc type is an adapter to allow the use of ordinary function as APIToken mutator.

func (APITokenFunc) Mutate

Mutate calls f(ctx, m).

type ActionPlanFunc added in v0.3.3

The ActionPlanFunc type is an adapter to allow the use of ordinary function as ActionPlan mutator.

func (ActionPlanFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type ActionPlanHistoryFunc added in v0.3.3

type ActionPlanHistoryFunc func(context.Context, *generated.ActionPlanHistoryMutation) (generated.Value, error)

The ActionPlanHistoryFunc type is an adapter to allow the use of ordinary function as ActionPlanHistory mutator.

func (ActionPlanHistoryFunc) Mutate added in v0.3.3

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 ...generated.Hook) Chain

NewChain creates a new chain of hooks.

func (Chain) Append

func (c Chain) Append(hooks ...generated.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() generated.Hook

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

type Condition

type Condition func(context.Context, generated.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 generated.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 ContactFunc

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

func (ContactFunc) Mutate

Mutate calls f(ctx, m).

type ContactHistoryFunc

type ContactHistoryFunc func(context.Context, *generated.ContactHistoryMutation) (generated.Value, error)

The ContactHistoryFunc type is an adapter to allow the use of ordinary function as ContactHistory mutator.

func (ContactHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ControlFunc added in v0.3.3

The ControlFunc type is an adapter to allow the use of ordinary function as Control mutator.

func (ControlFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type ControlHistoryFunc added in v0.3.3

type ControlHistoryFunc func(context.Context, *generated.ControlHistoryMutation) (generated.Value, error)

The ControlHistoryFunc type is an adapter to allow the use of ordinary function as ControlHistory mutator.

func (ControlHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type ControlObjectiveFunc added in v0.3.3

type ControlObjectiveFunc func(context.Context, *generated.ControlObjectiveMutation) (generated.Value, error)

The ControlObjectiveFunc type is an adapter to allow the use of ordinary function as ControlObjective mutator.

func (ControlObjectiveFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type ControlObjectiveHistoryFunc added in v0.3.3

type ControlObjectiveHistoryFunc func(context.Context, *generated.ControlObjectiveHistoryMutation) (generated.Value, error)

The ControlObjectiveHistoryFunc type is an adapter to allow the use of ordinary function as ControlObjectiveHistory mutator.

func (ControlObjectiveHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type DocumentDataFunc

The DocumentDataFunc type is an adapter to allow the use of ordinary function as DocumentData mutator.

func (DocumentDataFunc) Mutate

Mutate calls f(ctx, m).

type DocumentDataHistoryFunc

type DocumentDataHistoryFunc func(context.Context, *generated.DocumentDataHistoryMutation) (generated.Value, error)

The DocumentDataHistoryFunc type is an adapter to allow the use of ordinary function as DocumentDataHistory mutator.

func (DocumentDataHistoryFunc) Mutate

Mutate calls f(ctx, m).

type EmailVerificationTokenFunc

type EmailVerificationTokenFunc func(context.Context, *generated.EmailVerificationTokenMutation) (generated.Value, error)

The EmailVerificationTokenFunc type is an adapter to allow the use of ordinary function as EmailVerificationToken mutator.

func (EmailVerificationTokenFunc) Mutate

Mutate calls f(ctx, m).

type EntitlementFunc

The EntitlementFunc type is an adapter to allow the use of ordinary function as Entitlement mutator.

func (EntitlementFunc) Mutate

Mutate calls f(ctx, m).

type EntitlementHistoryFunc

type EntitlementHistoryFunc func(context.Context, *generated.EntitlementHistoryMutation) (generated.Value, error)

The EntitlementHistoryFunc type is an adapter to allow the use of ordinary function as EntitlementHistory mutator.

func (EntitlementHistoryFunc) Mutate

Mutate calls f(ctx, m).

type EntitlementPlanFeatureFunc

type EntitlementPlanFeatureFunc func(context.Context, *generated.EntitlementPlanFeatureMutation) (generated.Value, error)

The EntitlementPlanFeatureFunc type is an adapter to allow the use of ordinary function as EntitlementPlanFeature mutator.

func (EntitlementPlanFeatureFunc) Mutate

Mutate calls f(ctx, m).

type EntitlementPlanFeatureHistoryFunc

type EntitlementPlanFeatureHistoryFunc func(context.Context, *generated.EntitlementPlanFeatureHistoryMutation) (generated.Value, error)

The EntitlementPlanFeatureHistoryFunc type is an adapter to allow the use of ordinary function as EntitlementPlanFeatureHistory mutator.

func (EntitlementPlanFeatureHistoryFunc) Mutate

Mutate calls f(ctx, m).

type EntitlementPlanFunc

type EntitlementPlanFunc func(context.Context, *generated.EntitlementPlanMutation) (generated.Value, error)

The EntitlementPlanFunc type is an adapter to allow the use of ordinary function as EntitlementPlan mutator.

func (EntitlementPlanFunc) Mutate

Mutate calls f(ctx, m).

type EntitlementPlanHistoryFunc

type EntitlementPlanHistoryFunc func(context.Context, *generated.EntitlementPlanHistoryMutation) (generated.Value, error)

The EntitlementPlanHistoryFunc type is an adapter to allow the use of ordinary function as EntitlementPlanHistory mutator.

func (EntitlementPlanHistoryFunc) Mutate

Mutate calls f(ctx, m).

type EntityFunc

The EntityFunc type is an adapter to allow the use of ordinary function as Entity mutator.

func (EntityFunc) Mutate

Mutate calls f(ctx, m).

type EntityHistoryFunc

type EntityHistoryFunc func(context.Context, *generated.EntityHistoryMutation) (generated.Value, error)

The EntityHistoryFunc type is an adapter to allow the use of ordinary function as EntityHistory mutator.

func (EntityHistoryFunc) Mutate

Mutate calls f(ctx, m).

type EntityTypeFunc

The EntityTypeFunc type is an adapter to allow the use of ordinary function as EntityType mutator.

func (EntityTypeFunc) Mutate

Mutate calls f(ctx, m).

type EntityTypeHistoryFunc

type EntityTypeHistoryFunc func(context.Context, *generated.EntityTypeHistoryMutation) (generated.Value, error)

The EntityTypeHistoryFunc type is an adapter to allow the use of ordinary function as EntityTypeHistory mutator.

func (EntityTypeHistoryFunc) Mutate

Mutate calls f(ctx, m).

type EventFunc

The EventFunc type is an adapter to allow the use of ordinary function as Event mutator.

func (EventFunc) Mutate

Mutate calls f(ctx, m).

type EventHistoryFunc

The EventHistoryFunc type is an adapter to allow the use of ordinary function as EventHistory mutator.

func (EventHistoryFunc) Mutate

Mutate calls f(ctx, m).

type FeatureFunc

The FeatureFunc type is an adapter to allow the use of ordinary function as Feature mutator.

func (FeatureFunc) Mutate

Mutate calls f(ctx, m).

type FeatureHistoryFunc

type FeatureHistoryFunc func(context.Context, *generated.FeatureHistoryMutation) (generated.Value, error)

The FeatureHistoryFunc type is an adapter to allow the use of ordinary function as FeatureHistory mutator.

func (FeatureHistoryFunc) Mutate

Mutate calls f(ctx, m).

type FileFunc

The FileFunc type is an adapter to allow the use of ordinary function as File mutator.

func (FileFunc) Mutate

Mutate calls f(ctx, m).

type FileHistoryFunc

The FileHistoryFunc type is an adapter to allow the use of ordinary function as FileHistory mutator.

func (FileHistoryFunc) Mutate

Mutate calls f(ctx, m).

type GroupFunc

The GroupFunc type is an adapter to allow the use of ordinary function as Group mutator.

func (GroupFunc) Mutate

Mutate calls f(ctx, m).

type GroupHistoryFunc

The GroupHistoryFunc type is an adapter to allow the use of ordinary function as GroupHistory mutator.

func (GroupHistoryFunc) Mutate

Mutate calls f(ctx, m).

type GroupMembershipFunc

type GroupMembershipFunc func(context.Context, *generated.GroupMembershipMutation) (generated.Value, error)

The GroupMembershipFunc type is an adapter to allow the use of ordinary function as GroupMembership mutator.

func (GroupMembershipFunc) Mutate

Mutate calls f(ctx, m).

type GroupMembershipHistoryFunc

type GroupMembershipHistoryFunc func(context.Context, *generated.GroupMembershipHistoryMutation) (generated.Value, error)

The GroupMembershipHistoryFunc type is an adapter to allow the use of ordinary function as GroupMembershipHistory mutator.

func (GroupMembershipHistoryFunc) Mutate

Mutate calls f(ctx, m).

type GroupSettingFunc

The GroupSettingFunc type is an adapter to allow the use of ordinary function as GroupSetting mutator.

func (GroupSettingFunc) Mutate

Mutate calls f(ctx, m).

type GroupSettingHistoryFunc

type GroupSettingHistoryFunc func(context.Context, *generated.GroupSettingHistoryMutation) (generated.Value, error)

The GroupSettingHistoryFunc type is an adapter to allow the use of ordinary function as GroupSettingHistory mutator.

func (GroupSettingHistoryFunc) Mutate

Mutate calls f(ctx, m).

type HushFunc

The HushFunc type is an adapter to allow the use of ordinary function as Hush mutator.

func (HushFunc) Mutate

Mutate calls f(ctx, m).

type HushHistoryFunc

The HushHistoryFunc type is an adapter to allow the use of ordinary function as HushHistory mutator.

func (HushHistoryFunc) Mutate

Mutate calls f(ctx, m).

type IntegrationFunc

The IntegrationFunc type is an adapter to allow the use of ordinary function as Integration mutator.

func (IntegrationFunc) Mutate

Mutate calls f(ctx, m).

type IntegrationHistoryFunc

type IntegrationHistoryFunc func(context.Context, *generated.IntegrationHistoryMutation) (generated.Value, error)

The IntegrationHistoryFunc type is an adapter to allow the use of ordinary function as IntegrationHistory mutator.

func (IntegrationHistoryFunc) Mutate

Mutate calls f(ctx, m).

type InternalPolicyFunc added in v0.3.3

type InternalPolicyFunc func(context.Context, *generated.InternalPolicyMutation) (generated.Value, error)

The InternalPolicyFunc type is an adapter to allow the use of ordinary function as InternalPolicy mutator.

func (InternalPolicyFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type InternalPolicyHistoryFunc added in v0.3.3

type InternalPolicyHistoryFunc func(context.Context, *generated.InternalPolicyHistoryMutation) (generated.Value, error)

The InternalPolicyHistoryFunc type is an adapter to allow the use of ordinary function as InternalPolicyHistory mutator.

func (InternalPolicyHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type InviteFunc

The InviteFunc type is an adapter to allow the use of ordinary function as Invite mutator.

func (InviteFunc) Mutate

Mutate calls f(ctx, m).

type NarrativeFunc added in v0.3.3

The NarrativeFunc type is an adapter to allow the use of ordinary function as Narrative mutator.

func (NarrativeFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type NarrativeHistoryFunc added in v0.3.3

type NarrativeHistoryFunc func(context.Context, *generated.NarrativeHistoryMutation) (generated.Value, error)

The NarrativeHistoryFunc type is an adapter to allow the use of ordinary function as NarrativeHistory mutator.

func (NarrativeHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type NoteFunc

The NoteFunc type is an adapter to allow the use of ordinary function as Note mutator.

func (NoteFunc) Mutate

Mutate calls f(ctx, m).

type NoteHistoryFunc

The NoteHistoryFunc type is an adapter to allow the use of ordinary function as NoteHistory mutator.

func (NoteHistoryFunc) Mutate

Mutate calls f(ctx, m).

type OauthProviderFunc

type OauthProviderFunc func(context.Context, *generated.OauthProviderMutation) (generated.Value, error)

The OauthProviderFunc type is an adapter to allow the use of ordinary function as OauthProvider mutator.

func (OauthProviderFunc) Mutate

Mutate calls f(ctx, m).

type OauthProviderHistoryFunc

type OauthProviderHistoryFunc func(context.Context, *generated.OauthProviderHistoryMutation) (generated.Value, error)

The OauthProviderHistoryFunc type is an adapter to allow the use of ordinary function as OauthProviderHistory mutator.

func (OauthProviderHistoryFunc) Mutate

Mutate calls f(ctx, m).

type OhAuthTooTokenFunc

type OhAuthTooTokenFunc func(context.Context, *generated.OhAuthTooTokenMutation) (generated.Value, error)

The OhAuthTooTokenFunc type is an adapter to allow the use of ordinary function as OhAuthTooToken mutator.

func (OhAuthTooTokenFunc) Mutate

Mutate calls f(ctx, m).

type OrgMembershipFunc

type OrgMembershipFunc func(context.Context, *generated.OrgMembershipMutation) (generated.Value, error)

The OrgMembershipFunc type is an adapter to allow the use of ordinary function as OrgMembership mutator.

func (OrgMembershipFunc) Mutate

Mutate calls f(ctx, m).

type OrgMembershipHistoryFunc

type OrgMembershipHistoryFunc func(context.Context, *generated.OrgMembershipHistoryMutation) (generated.Value, error)

The OrgMembershipHistoryFunc type is an adapter to allow the use of ordinary function as OrgMembershipHistory mutator.

func (OrgMembershipHistoryFunc) Mutate

Mutate calls f(ctx, m).

type OrganizationFunc

The OrganizationFunc type is an adapter to allow the use of ordinary function as Organization mutator.

func (OrganizationFunc) Mutate

Mutate calls f(ctx, m).

type OrganizationHistoryFunc

type OrganizationHistoryFunc func(context.Context, *generated.OrganizationHistoryMutation) (generated.Value, error)

The OrganizationHistoryFunc type is an adapter to allow the use of ordinary function as OrganizationHistory mutator.

func (OrganizationHistoryFunc) Mutate

Mutate calls f(ctx, m).

type OrganizationSettingFunc

type OrganizationSettingFunc func(context.Context, *generated.OrganizationSettingMutation) (generated.Value, error)

The OrganizationSettingFunc type is an adapter to allow the use of ordinary function as OrganizationSetting mutator.

func (OrganizationSettingFunc) Mutate

Mutate calls f(ctx, m).

type OrganizationSettingHistoryFunc

type OrganizationSettingHistoryFunc func(context.Context, *generated.OrganizationSettingHistoryMutation) (generated.Value, error)

The OrganizationSettingHistoryFunc type is an adapter to allow the use of ordinary function as OrganizationSettingHistory mutator.

func (OrganizationSettingHistoryFunc) Mutate

Mutate calls f(ctx, m).

type PasswordResetTokenFunc

type PasswordResetTokenFunc func(context.Context, *generated.PasswordResetTokenMutation) (generated.Value, error)

The PasswordResetTokenFunc type is an adapter to allow the use of ordinary function as PasswordResetToken mutator.

func (PasswordResetTokenFunc) Mutate

Mutate calls f(ctx, m).

type PersonalAccessTokenFunc

type PersonalAccessTokenFunc func(context.Context, *generated.PersonalAccessTokenMutation) (generated.Value, error)

The PersonalAccessTokenFunc type is an adapter to allow the use of ordinary function as PersonalAccessToken mutator.

func (PersonalAccessTokenFunc) Mutate

Mutate calls f(ctx, m).

type ProcedureFunc added in v0.3.3

The ProcedureFunc type is an adapter to allow the use of ordinary function as Procedure mutator.

func (ProcedureFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type ProcedureHistoryFunc added in v0.3.3

type ProcedureHistoryFunc func(context.Context, *generated.ProcedureHistoryMutation) (generated.Value, error)

The ProcedureHistoryFunc type is an adapter to allow the use of ordinary function as ProcedureHistory mutator.

func (ProcedureHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type RiskFunc added in v0.3.3

The RiskFunc type is an adapter to allow the use of ordinary function as Risk mutator.

func (RiskFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type RiskHistoryFunc added in v0.3.3

The RiskHistoryFunc type is an adapter to allow the use of ordinary function as RiskHistory mutator.

func (RiskHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type StandardFunc added in v0.3.3

The StandardFunc type is an adapter to allow the use of ordinary function as Standard mutator.

func (StandardFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type StandardHistoryFunc added in v0.3.3

type StandardHistoryFunc func(context.Context, *generated.StandardHistoryMutation) (generated.Value, error)

The StandardHistoryFunc type is an adapter to allow the use of ordinary function as StandardHistory mutator.

func (StandardHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type SubcontrolFunc added in v0.3.3

The SubcontrolFunc type is an adapter to allow the use of ordinary function as Subcontrol mutator.

func (SubcontrolFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type SubcontrolHistoryFunc added in v0.3.3

type SubcontrolHistoryFunc func(context.Context, *generated.SubcontrolHistoryMutation) (generated.Value, error)

The SubcontrolHistoryFunc type is an adapter to allow the use of ordinary function as SubcontrolHistory mutator.

func (SubcontrolHistoryFunc) Mutate added in v0.3.3

Mutate calls f(ctx, m).

type SubscriberFunc

The SubscriberFunc type is an adapter to allow the use of ordinary function as Subscriber mutator.

func (SubscriberFunc) Mutate

Mutate calls f(ctx, m).

type TFASettingFunc

The TFASettingFunc type is an adapter to allow the use of ordinary function as TFASetting mutator.

func (TFASettingFunc) Mutate

Mutate calls f(ctx, m).

type TemplateFunc

The TemplateFunc type is an adapter to allow the use of ordinary function as Template mutator.

func (TemplateFunc) Mutate

Mutate calls f(ctx, m).

type TemplateHistoryFunc

type TemplateHistoryFunc func(context.Context, *generated.TemplateHistoryMutation) (generated.Value, error)

The TemplateHistoryFunc type is an adapter to allow the use of ordinary function as TemplateHistory mutator.

func (TemplateHistoryFunc) Mutate

Mutate calls f(ctx, m).

type UserFunc

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

func (UserFunc) Mutate

Mutate calls f(ctx, m).

type UserHistoryFunc

The UserHistoryFunc type is an adapter to allow the use of ordinary function as UserHistory mutator.

func (UserHistoryFunc) Mutate

Mutate calls f(ctx, m).

type UserSettingFunc

The UserSettingFunc type is an adapter to allow the use of ordinary function as UserSetting mutator.

func (UserSettingFunc) Mutate

Mutate calls f(ctx, m).

type UserSettingHistoryFunc

type UserSettingHistoryFunc func(context.Context, *generated.UserSettingHistoryMutation) (generated.Value, error)

The UserSettingHistoryFunc type is an adapter to allow the use of ordinary function as UserSettingHistory mutator.

func (UserSettingHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WebauthnFunc

The WebauthnFunc type is an adapter to allow the use of ordinary function as Webauthn mutator.

func (WebauthnFunc) Mutate

Mutate calls f(ctx, m).

type WebhookFunc

The WebhookFunc type is an adapter to allow the use of ordinary function as Webhook mutator.

func (WebhookFunc) Mutate

Mutate calls f(ctx, m).

type WebhookHistoryFunc

type WebhookHistoryFunc func(context.Context, *generated.WebhookHistoryMutation) (generated.Value, error)

The WebhookHistoryFunc type is an adapter to allow the use of ordinary function as WebhookHistory mutator.

func (WebhookHistoryFunc) Mutate

Mutate calls f(ctx, m).

Jump to

Keyboard shortcuts

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