mixin

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package mixin contains the mixin package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditHook

func AuditHook(next ent.Mutator) ent.Mutator

AuditHook sets and returns the created_at, updated_at, etc., fields

Types

type AuditMixin

type AuditMixin struct {
	mixin.Schema
}

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.

func (AuditMixin) Fields

func (AuditMixin) Fields() []ent.Field

Fields of the AuditMixin

func (AuditMixin) Hooks

func (AuditMixin) Hooks() []ent.Hook

Hooks of the AuditMixin

type HookFunc added in v0.4.3

type HookFunc func(i IDMixin) ent.Hook

type IDMixin

type IDMixin struct {
	mixin.Schema
	// IncludeMappingID to include the mapping ID field to the schema that can be used without exposing the primary ID
	// by default, it is not included by default
	IncludeMappingID bool
	// HumanIdentifierPrefix is the prefix to use for the human identifier, if set a display_id field will be added
	// based on the original ID
	HumanIdentifierPrefix string
	// OverrideDefaultIndex to override the default index set on the display ID
	OverrideDefaultIndex string
	// SingleFieldIndex to set a single field index on the display ID
	SingleFieldIndex bool
	// OverrideDisplayID field name lets you customize the display ID field name
	OverrideDisplayID string
	// DisplayIDLength is the length of the display ID without the prefix, defaults to 6
	DisplayIDLength int
}

IDMixin holds the schema definition for the ID

func NewIDMixinWithMappingID added in v0.4.0

func NewIDMixinWithMappingID() IDMixin

NewIDMixinWithMappingID creates a new IDMixin and includes an additional mapping ID

func NewIDMixinWithPrefixedID added in v0.4.0

func NewIDMixinWithPrefixedID(prefix string) IDMixin

NewIDMixinWithPrefixedID creates a new IDMixin and includes an additional prefixed ID, e.g. TSK-000001

func (IDMixin) Fields

func (i IDMixin) Fields() []ent.Field

Fields of the IDMixin.

func (IDMixin) Hooks added in v0.4.3

func (i IDMixin) Hooks() []ent.Hook

Hooks of the IDMixin

func (IDMixin) Indexes added in v0.4.3

func (i IDMixin) Indexes() []ent.Index

Indexes of the IDMixin

type TagMixin

type TagMixin struct {
	mixin.Schema
}

TagMixin holds the schema definition for the tags

func (TagMixin) Fields

func (t TagMixin) Fields() []ent.Field

Fields of the TagMixin.

type UnexpectedAuditError

type UnexpectedAuditError struct {
	MutationType ent.Mutation
}

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

Jump to

Keyboard shortcuts

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