Documentation
¶
Overview ¶
Package mixin contains the mixin package
Index ¶
- Constants
- func HookSystemOwnedCreate() ent.Hook
- func SystemOwnedSchema() privacy.MutationRuleFunc
- type GraphQLAnnotationMixin
- type OrgOwnedMutation
- type RevisionMixin
- type SoftDeleteMixin
- type SystemOwnedMixin
- type SystemOwnedMixinOption
- type SystemOwnedMutation
- type TagMixin
- type UnexpectedMutationTypeError
- type UserOwnedMutationPolicyMixin
- type UserOwnedQueryPolicyMixin
Constants ¶
const (
// SystemOwnedMixinName is the name of the SystemOwnedMixin
SystemOwnedMixinName = "SystemOwnedMixin"
)
Variables ¶
This section is empty.
Functions ¶
func HookSystemOwnedCreate ¶ added in v0.34.0
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
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 RevisionMixin ¶ added in v0.7.5
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 ¶
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
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
type SystemOwnedMutation ¶ added in v0.8.3
type SystemOwnedMutation interface {
utils.GenericMutation
Field(name string) (ent.Value, bool)
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)
OwnerID() (string, bool)
SetOwnerID(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
TagMixin holds the schema definition for the tags
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
type UserOwnedMutationPolicyMixin ¶
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 ¶
UserOwnedQueryPolicyMixin is a mixin for user owned query policy