Documentation ¶
Overview ¶
Package mixin contains the mixin package
Index ¶
- Variables
- func AuditHook(next ent.Mutator) ent.Mutator
- func CheckIsSoftDelete(ctx context.Context) bool
- func CheckSkipSoftDelete(ctx context.Context) bool
- func IsSoftDelete(parent context.Context) context.Context
- func SkipSoftDelete(parent context.Context) context.Context
- type AuditMixin
- type IDMixin
- type SoftDeleteMixin
- type UnexpectedAuditError
- type UnexpectedMutationTypeError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidTokenSize is returned when session token size is invalid ErrInvalidTokenSize = errors.New("invalid token size") )
Functions ¶
func CheckIsSoftDelete ¶
CheckIsSoftDelete checks if the softDeleteKey is set in the context
func CheckSkipSoftDelete ¶
CheckSkipSoftDelete checks if the softDeleteSkipKey is set in the context
func IsSoftDelete ¶
IsSoftDelete returns a new context that informs the delete is a soft-delete for interceptor/hooks.
Types ¶
type AuditMixin ¶
AuditMixin provides auditing for all records where enabled. The created_at, created_by, updated_at, and updated_by records are automatically populated when this mixin is enabled.
type SoftDeleteMixin ¶
SoftDeleteMixin implements the soft delete pattern for schemas.
func (SoftDeleteMixin) Fields ¶
func (SoftDeleteMixin) Fields() []ent.Field
Fields of the SoftDeleteMixin.
func (SoftDeleteMixin) Hooks ¶
func (d SoftDeleteMixin) Hooks() []ent.Hook
Hooks of the SoftDeleteMixin.
func (SoftDeleteMixin) Interceptors ¶
func (d SoftDeleteMixin) Interceptors() []ent.Interceptor
Interceptors of the SoftDeleteMixin.
func (SoftDeleteMixin) P ¶
func (d SoftDeleteMixin) P(w interface{ WhereP(...func(*sql.Selector)) })
P adds a storage-level predicate to the queries and mutations.
func (SoftDeleteMixin) SoftDeleteHook ¶
func (d SoftDeleteMixin) SoftDeleteHook(next ent.Mutator) ent.Mutator
SoftDeleteHook will soft delete records, by changing the delete mutation to an update and setting the deleted_at and deleted_by fields, unless the softDeleteSkipKey is set
type UnexpectedAuditError ¶
UnexpectedAuditError is returned when an unexpected audit log call is received
func (*UnexpectedAuditError) Error ¶
func (e *UnexpectedAuditError) Error() string
Error returns the UnexpectedAuditError in string format
type UnexpectedMutationTypeError ¶
UnexpectedMutationTypeError is returned when an unexpected mutation type is parsed
func (*UnexpectedMutationTypeError) Error ¶
func (e *UnexpectedMutationTypeError) Error() string
Error returns the UnexpectedAuditError in string format