hook

package
v1.11.21 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 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) historygenerated.Hook

FixedError is a hook returning a fixed error.

func If

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, historygenerated.Delete|historygenerated.Create)

func Reject

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

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

func Unless

Unless skips the given hook only for the given operation.

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

Types

type ActionPlanHistoryFunc

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

func (ActionPlanHistoryFunc) Mutate

Mutate calls f(ctx, m).

type AssessmentHistoryFunc

The AssessmentHistoryFunc type is an adapter to allow the use of ordinary function as AssessmentHistory mutator.

func (AssessmentHistoryFunc) Mutate

Mutate calls f(ctx, m).

type AssessmentResponseHistoryFunc

The AssessmentResponseHistoryFunc type is an adapter to allow the use of ordinary function as AssessmentResponseHistory mutator.

func (AssessmentResponseHistoryFunc) Mutate

Mutate calls f(ctx, m).

type AssetHistoryFunc

The AssetHistoryFunc type is an adapter to allow the use of ordinary function as AssetHistory mutator.

func (AssetHistoryFunc) Mutate

Mutate calls f(ctx, m).

type CampaignHistoryFunc added in v1.5.0

The CampaignHistoryFunc type is an adapter to allow the use of ordinary function as CampaignHistory mutator.

func (CampaignHistoryFunc) Mutate added in v1.5.0

Mutate calls f(ctx, m).

type CampaignTargetHistoryFunc added in v1.5.0

The CampaignTargetHistoryFunc type is an adapter to allow the use of ordinary function as CampaignTargetHistory mutator.

func (CampaignTargetHistoryFunc) Mutate added in v1.5.0

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

NewChain creates a new chain of hooks.

func (Chain) Append

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

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

type Condition

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

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 ControlHistoryFunc

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

func (ControlHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ControlImplementationHistoryFunc

The ControlImplementationHistoryFunc type is an adapter to allow the use of ordinary function as ControlImplementationHistory mutator.

func (ControlImplementationHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ControlObjectiveHistoryFunc

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

func (ControlObjectiveHistoryFunc) Mutate

Mutate calls f(ctx, m).

type CustomDomainHistoryFunc

The CustomDomainHistoryFunc type is an adapter to allow the use of ordinary function as CustomDomainHistory mutator.

func (CustomDomainHistoryFunc) Mutate

Mutate calls f(ctx, m).

type DNSVerificationHistoryFunc

The DNSVerificationHistoryFunc type is an adapter to allow the use of ordinary function as DNSVerificationHistory mutator.

func (DNSVerificationHistoryFunc) Mutate

Mutate calls f(ctx, m).

type DirectoryAccountHistoryFunc

The DirectoryAccountHistoryFunc type is an adapter to allow the use of ordinary function as DirectoryAccountHistory mutator.

func (DirectoryAccountHistoryFunc) Mutate

Mutate calls f(ctx, m).

type DirectoryGroupHistoryFunc

The DirectoryGroupHistoryFunc type is an adapter to allow the use of ordinary function as DirectoryGroupHistory mutator.

func (DirectoryGroupHistoryFunc) Mutate

Mutate calls f(ctx, m).

type DirectoryMembershipHistoryFunc

The DirectoryMembershipHistoryFunc type is an adapter to allow the use of ordinary function as DirectoryMembershipHistory mutator.

func (DirectoryMembershipHistoryFunc) Mutate

Mutate calls f(ctx, m).

type DiscussionHistoryFunc

The DiscussionHistoryFunc type is an adapter to allow the use of ordinary function as DiscussionHistory mutator.

func (DiscussionHistoryFunc) Mutate

Mutate calls f(ctx, m).

type DocumentDataHistoryFunc

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 EmailBrandingHistoryFunc added in v1.7.0

The EmailBrandingHistoryFunc type is an adapter to allow the use of ordinary function as EmailBrandingHistory mutator.

func (EmailBrandingHistoryFunc) Mutate added in v1.7.0

Mutate calls f(ctx, m).

type EmailTemplateHistoryFunc added in v1.7.0

The EmailTemplateHistoryFunc type is an adapter to allow the use of ordinary function as EmailTemplateHistory mutator.

func (EmailTemplateHistoryFunc) Mutate added in v1.7.0

Mutate calls f(ctx, m).

type EntityHistoryFunc

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 EntityTypeHistoryFunc

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 EvidenceHistoryFunc

The EvidenceHistoryFunc type is an adapter to allow the use of ordinary function as EvidenceHistory mutator.

func (EvidenceHistoryFunc) 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 FindingControlHistoryFunc

The FindingControlHistoryFunc type is an adapter to allow the use of ordinary function as FindingControlHistory mutator.

func (FindingControlHistoryFunc) Mutate

Mutate calls f(ctx, m).

type FindingHistoryFunc

The FindingHistoryFunc type is an adapter to allow the use of ordinary function as FindingHistory mutator.

func (FindingHistoryFunc) 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 GroupMembershipHistoryFunc

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 GroupSettingHistoryFunc

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 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 IdentityHolderHistoryFunc added in v1.5.0

The IdentityHolderHistoryFunc type is an adapter to allow the use of ordinary function as IdentityHolderHistory mutator.

func (IdentityHolderHistoryFunc) Mutate added in v1.5.0

Mutate calls f(ctx, m).

type IntegrationHistoryFunc

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 InternalPolicyHistoryFunc

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

func (InternalPolicyHistoryFunc) Mutate

Mutate calls f(ctx, m).

type JobTemplateHistoryFunc

The JobTemplateHistoryFunc type is an adapter to allow the use of ordinary function as JobTemplateHistory mutator.

func (JobTemplateHistoryFunc) Mutate

Mutate calls f(ctx, m).

type MappableDomainHistoryFunc

The MappableDomainHistoryFunc type is an adapter to allow the use of ordinary function as MappableDomainHistory mutator.

func (MappableDomainHistoryFunc) Mutate

Mutate calls f(ctx, m).

type MappedControlHistoryFunc

The MappedControlHistoryFunc type is an adapter to allow the use of ordinary function as MappedControlHistory mutator.

func (MappedControlHistoryFunc) Mutate

Mutate calls f(ctx, m).

type NarrativeHistoryFunc

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

func (NarrativeHistoryFunc) 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 NotificationPreferenceHistoryFunc added in v1.7.0

The NotificationPreferenceHistoryFunc type is an adapter to allow the use of ordinary function as NotificationPreferenceHistory mutator.

func (NotificationPreferenceHistoryFunc) Mutate added in v1.7.0

Mutate calls f(ctx, m).

type NotificationTemplateHistoryFunc added in v1.7.0

The NotificationTemplateHistoryFunc type is an adapter to allow the use of ordinary function as NotificationTemplateHistory mutator.

func (NotificationTemplateHistoryFunc) Mutate added in v1.7.0

Mutate calls f(ctx, m).

type OrgMembershipHistoryFunc

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 OrgSubscriptionHistoryFunc

The OrgSubscriptionHistoryFunc type is an adapter to allow the use of ordinary function as OrgSubscriptionHistory mutator.

func (OrgSubscriptionHistoryFunc) Mutate

Mutate calls f(ctx, m).

type OrganizationHistoryFunc

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 OrganizationSettingHistoryFunc

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 PlatformHistoryFunc added in v1.5.0

The PlatformHistoryFunc type is an adapter to allow the use of ordinary function as PlatformHistory mutator.

func (PlatformHistoryFunc) Mutate added in v1.5.0

Mutate calls f(ctx, m).

type ProcedureHistoryFunc

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

func (ProcedureHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ProgramHistoryFunc

The ProgramHistoryFunc type is an adapter to allow the use of ordinary function as ProgramHistory mutator.

func (ProgramHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ProgramMembershipHistoryFunc

The ProgramMembershipHistoryFunc type is an adapter to allow the use of ordinary function as ProgramMembershipHistory mutator.

func (ProgramMembershipHistoryFunc) Mutate

Mutate calls f(ctx, m).

type RemediationHistoryFunc

The RemediationHistoryFunc type is an adapter to allow the use of ordinary function as RemediationHistory mutator.

func (RemediationHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ReviewHistoryFunc

The ReviewHistoryFunc type is an adapter to allow the use of ordinary function as ReviewHistory mutator.

func (ReviewHistoryFunc) Mutate

Mutate calls f(ctx, m).

type RiskHistoryFunc

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

func (RiskHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ScanHistoryFunc

The ScanHistoryFunc type is an adapter to allow the use of ordinary function as ScanHistory mutator.

func (ScanHistoryFunc) Mutate

Mutate calls f(ctx, m).

type ScheduledJobHistoryFunc

The ScheduledJobHistoryFunc type is an adapter to allow the use of ordinary function as ScheduledJobHistory mutator.

func (ScheduledJobHistoryFunc) Mutate

Mutate calls f(ctx, m).

type StandardHistoryFunc

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

func (StandardHistoryFunc) Mutate

Mutate calls f(ctx, m).

type SubcontrolHistoryFunc

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

func (SubcontrolHistoryFunc) Mutate

Mutate calls f(ctx, m).

type SubprocessorHistoryFunc

The SubprocessorHistoryFunc type is an adapter to allow the use of ordinary function as SubprocessorHistory mutator.

func (SubprocessorHistoryFunc) Mutate

Mutate calls f(ctx, m).

type SystemDetailHistoryFunc added in v1.11.6

The SystemDetailHistoryFunc type is an adapter to allow the use of ordinary function as SystemDetailHistory mutator.

func (SystemDetailHistoryFunc) Mutate added in v1.11.6

Mutate calls f(ctx, m).

type TaskHistoryFunc

The TaskHistoryFunc type is an adapter to allow the use of ordinary function as TaskHistory mutator.

func (TaskHistoryFunc) Mutate

Mutate calls f(ctx, m).

type TemplateHistoryFunc

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 TrustCenterComplianceHistoryFunc

The TrustCenterComplianceHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterComplianceHistory mutator.

func (TrustCenterComplianceHistoryFunc) Mutate

Mutate calls f(ctx, m).

type TrustCenterDocHistoryFunc

The TrustCenterDocHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterDocHistory mutator.

func (TrustCenterDocHistoryFunc) Mutate

Mutate calls f(ctx, m).

type TrustCenterEntityHistoryFunc added in v1.3.0

The TrustCenterEntityHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterEntityHistory mutator.

func (TrustCenterEntityHistoryFunc) Mutate added in v1.3.0

Mutate calls f(ctx, m).

type TrustCenterFAQHistoryFunc added in v1.9.11

The TrustCenterFAQHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterFAQHistory mutator.

func (TrustCenterFAQHistoryFunc) Mutate added in v1.9.11

Mutate calls f(ctx, m).

type TrustCenterHistoryFunc

The TrustCenterHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterHistory mutator.

func (TrustCenterHistoryFunc) Mutate

Mutate calls f(ctx, m).

type TrustCenterNDARequestHistoryFunc added in v1.3.5

The TrustCenterNDARequestHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterNDARequestHistory mutator.

func (TrustCenterNDARequestHistoryFunc) Mutate added in v1.3.5

Mutate calls f(ctx, m).

type TrustCenterSettingHistoryFunc

The TrustCenterSettingHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterSettingHistory mutator.

func (TrustCenterSettingHistoryFunc) Mutate

Mutate calls f(ctx, m).

type TrustCenterSubprocessorHistoryFunc

The TrustCenterSubprocessorHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterSubprocessorHistory mutator.

func (TrustCenterSubprocessorHistoryFunc) Mutate

Mutate calls f(ctx, m).

type TrustCenterWatermarkConfigHistoryFunc

The TrustCenterWatermarkConfigHistoryFunc type is an adapter to allow the use of ordinary function as TrustCenterWatermarkConfigHistory mutator.

func (TrustCenterWatermarkConfigHistoryFunc) 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 UserSettingHistoryFunc

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 VulnerabilityHistoryFunc

The VulnerabilityHistoryFunc type is an adapter to allow the use of ordinary function as VulnerabilityHistory mutator.

func (VulnerabilityHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WorkflowAssignmentHistoryFunc

The WorkflowAssignmentHistoryFunc type is an adapter to allow the use of ordinary function as WorkflowAssignmentHistory mutator.

func (WorkflowAssignmentHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WorkflowAssignmentTargetHistoryFunc

The WorkflowAssignmentTargetHistoryFunc type is an adapter to allow the use of ordinary function as WorkflowAssignmentTargetHistory mutator.

func (WorkflowAssignmentTargetHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WorkflowDefinitionHistoryFunc

The WorkflowDefinitionHistoryFunc type is an adapter to allow the use of ordinary function as WorkflowDefinitionHistory mutator.

func (WorkflowDefinitionHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WorkflowEventHistoryFunc

The WorkflowEventHistoryFunc type is an adapter to allow the use of ordinary function as WorkflowEventHistory mutator.

func (WorkflowEventHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WorkflowInstanceHistoryFunc

The WorkflowInstanceHistoryFunc type is an adapter to allow the use of ordinary function as WorkflowInstanceHistory mutator.

func (WorkflowInstanceHistoryFunc) Mutate

Mutate calls f(ctx, m).

type WorkflowObjectRefHistoryFunc

The WorkflowObjectRefHistoryFunc type is an adapter to allow the use of ordinary function as WorkflowObjectRefHistory mutator.

func (WorkflowObjectRefHistoryFunc) Mutate

Mutate calls f(ctx, m).

Jump to

Keyboard shortcuts

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