hooks

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatedByUpdatedByHook

func CreatedByUpdatedByHook(next ent.Mutator) ent.Mutator

CreatedByUpdatedByHook automatically sets created_by and updated_by fields

func EntityMutatePermission

func EntityMutatePermission(next ent.Mutator) ent.Mutator

EntityMutatePermission checks if the current user has permission to perform mutation operations This hook is applied to external API requests (GraphQL/REST) where isInternalOperationContextValue is not set

func EntityReadPermission

func EntityReadPermission() ent.Interceptor

EntityReadPermission creates an interceptor for read operations This interceptor is applied to external API requests (GraphQL/REST) where isInternalOperationContextValue is not set

Types

type LifecycleFilterMutation added in v0.1.9

type LifecycleFilterMutation interface {
	WhereEntityStateIn(states ...entity.EntityState)
}

LifecycleFilterMutation is an interface for mutations that support restricting by entity_state. The WhereEntityStateIn method is generated for entities with lifecycle enabled (UpdateMany/DeleteMany).

type LifecycleFilterQuery added in v0.1.9

type LifecycleFilterQuery interface {
	ent.Query
	WhereEntityStateIn(states ...entity.EntityState) ent.Query
}

LifecycleFilterQuery is an interface for queries that support filtering by entity_state. The WhereEntityStateIn method is generated for entities with lifecycle enabled.

type LifecycleMutationTargetsChecker added in v0.1.9

type LifecycleMutationTargetsChecker interface {
	TargetsAllowedByLifecycle(ctx context.Context) (*entity.EntityState, error)
}

LifecycleMutationTargetsChecker is implemented by lifecycle-entity mutations for UpdateOne/DeleteOne. permissionLifecycleAccess is one slice of allowed states per permission; empty slice means full access.

type QueryWithAdminCreatedBy

type QueryWithAdminCreatedBy interface {
	ent.Query
	WhereAdminCreatedBy(adminUserID string) ent.Query
}

QueryWithAdminCreatedBy is an interface for queries that support owner filtering. The WhereAdminCreatedBy method is generated by the ent template system.

type WherePred added in v0.1.9

type WherePred func(*sql.Selector)

Jump to

Keyboard shortcuts

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