mixin

package
v1.16.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package mixin contains the mixin package

Index

Constants

View Source
const (
	// SystemOwnedMixinName is the name of the SystemOwnedMixin
	SystemOwnedMixinName = "SystemOwnedMixin"
)

Variables

This section is empty.

Functions

func HookSystemOwnedCreate added in v0.34.0

func HookSystemOwnedCreate() ent.Hook

HookSystemOwnedCreate will automatically set the system_owned field to true if the user is a system admin and ensure there is an owner id when creating not system owned objects

func SystemOwnedSchema added in v0.34.0

func SystemOwnedSchema() privacy.MutationRuleFunc

SystemOwnedSchema is a privacy rule that checks if the object is system owned and if the user is a system admin For create operations, since the field is automatically set, we skip the check For update operations, the rule checks if the existing object is system owned and denys if it is and the user is not a system admin

Types

type GraphQLAnnotationMixin added in v0.8.2

type GraphQLAnnotationMixin struct {
	mixin.Schema
}

GraphQLAnnotationMixin implements the revision pattern for schemas. it will add default annotations to the schema used for most schemas that have full graphql support

func (GraphQLAnnotationMixin) Annotations added in v0.8.2

func (GraphQLAnnotationMixin) Annotations() []schema.Annotation

Annotations of the AnnotationMixin.

type OrgOwnedMutation added in v0.46.7

type OrgOwnedMutation interface {
	utils.GenericMutation

	OwnerID() (string, bool)
	SetOwnerID(string)
}

OrgOwnedMutation is an interface for interacting with the owner_id field in mutations

type RequestorMixin added in v1.2.9

type RequestorMixin struct {
	mixin.Schema
}

RequestorMixin holds the schema definition for the requestor_id field

func (RequestorMixin) Fields added in v1.2.9

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

Fields of the RequestorMixin

func (RequestorMixin) Hooks added in v1.2.9

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

Hooks of the RequestorMixin

type RevisionMixin added in v0.7.5

type RevisionMixin struct {
	mixin.Schema
}

RevisionMixin implements the revision pattern for schemas.

func (RevisionMixin) Fields added in v0.7.5

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

Fields of the RevisionMixin.

func (RevisionMixin) Hooks added in v0.7.5

func (d RevisionMixin) Hooks() []ent.Hook

Hooks of the RevisionMixin.

type SoftDeleteMixin

type SoftDeleteMixin struct {
	mixin.Schema
}

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 SystemOwnedMixin added in v0.8.3

type SystemOwnedMixin struct {
	mixin.Schema
	// contains filtered or unexported fields
}

SystemOwnedMixin implements the revision pattern for schemas.

func NewSystemOwnedMixin added in v0.34.0

func NewSystemOwnedMixin(opts ...SystemOwnedMixinOption) SystemOwnedMixin

NewSystemOwnedMixin creates a new SystemOwnedMixin with the given options. The options can be used to customize the behavior of the mixin, however, there are currently no options.

func (SystemOwnedMixin) Fields added in v0.8.3

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

Fields of the SystemOwnedMixin.

func (SystemOwnedMixin) Hooks added in v0.8.3

func (d SystemOwnedMixin) Hooks() []ent.Hook

Hooks of the SystemOwnedMixin.

func (SystemOwnedMixin) Name added in v0.34.0

func (SystemOwnedMixin) Name() string

Name of the SystemOwnedMixin

func (SystemOwnedMixin) Policy added in v0.34.0

func (d SystemOwnedMixin) Policy() ent.Policy

Policy of the SystemOwnedMixin

type SystemOwnedMixinOption added in v0.34.0

type SystemOwnedMixinOption func(*SystemOwnedMixin)

SystemOwnedMixinOption is a function that configures the SystemOwnedMixin

func SkipTupleCreation added in v1.3.0

func SkipTupleCreation() SystemOwnedMixinOption

SkipTupleCreation is an option to skip the creation of authz tuples for system owned objects

type SystemOwnedMutation added in v0.8.3

type SystemOwnedMutation interface {
	utils.GenericMutation

	FieldCleared(name string) bool
	SystemOwned() (bool, bool)
	SetSystemOwned(bool)
	OldSystemOwned(context.Context) (bool, error)
	SystemInternalID() (string, bool)
	ClearSystemInternalID()
	SetSystemInternalID(string)
	InternalNotes() (string, bool)
	ClearInternalNotes()
	SetInternalNotes(string)
}

SystemOwnedMutation is an interface for interacting with the system_owned field in mutations it will add the system_owned_field and will automatically set the field to true if the user is a system admin

type TagMixin added in v0.43.0

type TagMixin struct {
	mixin.Schema
}

TagMixin holds the schema definition for the tags

func (TagMixin) Fields added in v0.43.0

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

Fields of the TagMixin

func (TagMixin) Hooks added in v0.43.0

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

Hooks of the TagMixin

type UnexpectedMutationTypeError

type UnexpectedMutationTypeError struct {
	MutationType ent.Mutation
}

UnexpectedMutationTypeError is returned when an unexpected mutation type is parsed

func (*UnexpectedMutationTypeError) Error

Error returns the UnexpectedAuditError in string format

type UserOwnedMutationPolicyMixin

type UserOwnedMutationPolicyMixin struct {
	mixin.Schema
	AllowAdminMutation bool
}

UserOwnedMutationPolicyMixin is a mixin for user owned mutation policy

func (UserOwnedMutationPolicyMixin) Policy

func (mixin UserOwnedMutationPolicyMixin) Policy() ent.Policy

UserOwnedMutationPolicyMixin sets the policy for updating owned fields by the user

type UserOwnedQueryPolicyMixin

type UserOwnedQueryPolicyMixin struct {
	mixin.Schema
}

UserOwnedQueryPolicyMixin is a mixin for user owned query policy

Jump to

Keyboard shortcuts

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