Documentation ¶
Index ¶
- Variables
- func Allowf(format string, a ...interface{}) error
- func DecisionContext(parent context.Context, decision error) context.Context
- func Denyf(format string, a ...interface{}) error
- func Skipf(format string, a ...interface{}) error
- type CardMutationRuleFunc
- type CardQueryRuleFunc
- type CommentMutationRuleFunc
- type CommentQueryRuleFunc
- type FieldTypeMutationRuleFunc
- type FieldTypeQueryRuleFunc
- type FileMutationRuleFunc
- type FileQueryRuleFunc
- type FileTypeMutationRuleFunc
- type FileTypeQueryRuleFunc
- type GroupInfoMutationRuleFunc
- type GroupInfoQueryRuleFunc
- type GroupMutationRuleFunc
- type GroupQueryRuleFunc
- type ItemMutationRuleFunc
- type ItemQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type NodeMutationRuleFunc
- type NodeQueryRuleFunc
- type PetMutationRuleFunc
- type PetQueryRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type SpecMutationRuleFunc
- type SpecQueryRuleFunc
- type TaskMutationRuleFunc
- type TaskQueryRuleFunc
- type UserMutationRuleFunc
- type UserQueryRuleFunc
Constants ¶
This section is empty.
Variables ¶
var ( // Allow may be returned by rules to indicate that the policy // evaluation should terminate with an allow decision. Allow = errors.New("ent/privacy: allow rule") // Deny may be returned by rules to indicate that the policy // evaluation should terminate with an deny decision. Deny = errors.New("ent/privacy: deny rule") // Skip may be returned by rules to indicate that the policy // evaluation should continue to the next rule. Skip = errors.New("ent/privacy: skip rule") )
Functions ¶
func DecisionContext ¶
DecisionContext creates a decision context.
Types ¶
type CardMutationRuleFunc ¶
type CardMutationRuleFunc func(context.Context, *ent.CardMutation) error
The CardMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CardMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type CardQueryRuleFunc ¶
The CardQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type CommentMutationRuleFunc ¶
type CommentMutationRuleFunc func(context.Context, *ent.CommentMutation) error
The CommentMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CommentMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type CommentQueryRuleFunc ¶
type CommentQueryRuleFunc func(context.Context, *ent.CommentQuery) error
The CommentQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type FieldTypeMutationRuleFunc ¶
type FieldTypeMutationRuleFunc func(context.Context, *ent.FieldTypeMutation) error
The FieldTypeMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (FieldTypeMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type FieldTypeQueryRuleFunc ¶
type FieldTypeQueryRuleFunc func(context.Context, *ent.FieldTypeQuery) error
The FieldTypeQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type FileMutationRuleFunc ¶
type FileMutationRuleFunc func(context.Context, *ent.FileMutation) error
The FileMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (FileMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type FileQueryRuleFunc ¶
The FileQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type FileTypeMutationRuleFunc ¶
type FileTypeMutationRuleFunc func(context.Context, *ent.FileTypeMutation) error
The FileTypeMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (FileTypeMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type FileTypeQueryRuleFunc ¶
type FileTypeQueryRuleFunc func(context.Context, *ent.FileTypeQuery) error
The FileTypeQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type GroupInfoMutationRuleFunc ¶
type GroupInfoMutationRuleFunc func(context.Context, *ent.GroupInfoMutation) error
The GroupInfoMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (GroupInfoMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type GroupInfoQueryRuleFunc ¶
type GroupInfoQueryRuleFunc func(context.Context, *ent.GroupInfoQuery) error
The GroupInfoQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type GroupMutationRuleFunc ¶
type GroupMutationRuleFunc func(context.Context, *ent.GroupMutation) error
The GroupMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (GroupMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type GroupQueryRuleFunc ¶
type GroupQueryRuleFunc func(context.Context, *ent.GroupQuery) error
The GroupQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ItemMutationRuleFunc ¶
type ItemMutationRuleFunc func(context.Context, *ent.ItemMutation) error
The ItemMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ItemMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type ItemQueryRuleFunc ¶
The ItemQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type MutationPolicy ¶
type MutationPolicy []MutationRule
MutationPolicy combines multiple mutation rules into a single policy.
func (MutationPolicy) EvalMutation ¶
EvalMutation evaluates a mutation against a mutation policy.
type MutationRule ¶
MutationRule defines the interface deciding whether a mutation is allowed and optionally modify it.
func DenyMutationOperationRule ¶
func DenyMutationOperationRule(op ent.Op) MutationRule
DenyMutationOperationRule returns a rule denying specified mutation operation.
func OnMutationOperation ¶
func OnMutationOperation(rule MutationRule, op ent.Op) MutationRule
OnMutationOperation evaluates the given rule only on a given mutation operation.
type MutationRuleFunc ¶
MutationRuleFunc type is an adapter to allow the use of ordinary functions as mutation rules.
func (MutationRuleFunc) EvalMutation ¶
EvalMutation returns f(ctx, m).
type NodeMutationRuleFunc ¶
type NodeMutationRuleFunc func(context.Context, *ent.NodeMutation) error
The NodeMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (NodeMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type NodeQueryRuleFunc ¶
The NodeQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type PetMutationRuleFunc ¶
type PetMutationRuleFunc func(context.Context, *ent.PetMutation) error
The PetMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PetMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type PetQueryRuleFunc ¶
The PetQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type Policy ¶
type Policy struct { Query QueryPolicy Mutation MutationPolicy }
Policy groups query and mutation policies.
func (Policy) EvalMutation ¶
EvalMutation forwards evaluation to mutation policy.
type QueryMutationRule ¶
type QueryMutationRule interface { QueryRule MutationRule }
QueryMutationRule is the interface that groups query and mutation rules.
func AlwaysAllowRule ¶
func AlwaysAllowRule() QueryMutationRule
AlwaysAllowRule returns a rule that returns an allow decision.
func AlwaysDenyRule ¶
func AlwaysDenyRule() QueryMutationRule
AlwaysDenyRule returns a rule that returns a deny decision.
func ContextQueryMutationRule ¶
func ContextQueryMutationRule(eval func(context.Context) error) QueryMutationRule
ContextQueryMutationRule creates a query/mutation rule from a context eval func.
type QueryPolicy ¶
type QueryPolicy []QueryRule
QueryPolicy combines multiple query rules into a single policy.
type QueryRule ¶
QueryRule defines the interface deciding whether a query is allowed and optionally modify it.
type QueryRuleFunc ¶
QueryRuleFunc type is an adapter to allow the use of ordinary functions as query rules.
type SpecMutationRuleFunc ¶
type SpecMutationRuleFunc func(context.Context, *ent.SpecMutation) error
The SpecMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (SpecMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type SpecQueryRuleFunc ¶
The SpecQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type TaskMutationRuleFunc ¶ added in v0.4.1
type TaskMutationRuleFunc func(context.Context, *ent.TaskMutation) error
The TaskMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TaskMutationRuleFunc) EvalMutation ¶ added in v0.4.1
EvalMutation calls f(ctx, m).
type TaskQueryRuleFunc ¶ added in v0.4.1
The TaskQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type UserMutationRuleFunc ¶
type UserMutationRuleFunc func(context.Context, *ent.UserMutation) error
The UserMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (UserMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type UserQueryRuleFunc ¶
The UserQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.