Documentation ¶
Index ¶
- Variables
- func Allowf(format string, a ...interface{}) error
- func Denyf(format string, a ...interface{}) error
- func Skipf(format string, a ...interface{}) error
- type ClassroomMutationRuleFunc
- type ClassroomQueryRuleFunc
- type CredentialMutationRuleFunc
- type CredentialQueryRuleFunc
- type LevelMutationRuleFunc
- type LevelQueryRuleFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type UserLevelMutationRuleFunc
- type UserLevelQueryRuleFunc
- 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 ¶
Types ¶
type ClassroomMutationRuleFunc ¶
type ClassroomMutationRuleFunc func(context.Context, *ent.ClassroomMutation) error
The ClassroomMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ClassroomMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type ClassroomQueryRuleFunc ¶
type ClassroomQueryRuleFunc func(context.Context, *ent.ClassroomQuery) error
The ClassroomQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type CredentialMutationRuleFunc ¶
type CredentialMutationRuleFunc func(context.Context, *ent.CredentialMutation) error
The CredentialMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CredentialMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type CredentialQueryRuleFunc ¶
type CredentialQueryRuleFunc func(context.Context, *ent.CredentialQuery) error
The CredentialQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type LevelMutationRuleFunc ¶
type LevelMutationRuleFunc func(context.Context, *ent.LevelMutation) error
The LevelMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (LevelMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type LevelQueryRuleFunc ¶
type LevelQueryRuleFunc func(context.Context, *ent.LevelQuery) error
The LevelQueryRuleFunc 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.
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 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.
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 UserLevelMutationRuleFunc ¶
type UserLevelMutationRuleFunc func(context.Context, *ent.UserLevelMutation) error
The UserLevelMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (UserLevelMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type UserLevelQueryRuleFunc ¶
type UserLevelQueryRuleFunc func(context.Context, *ent.UserLevelQuery) error
The UserLevelQueryRuleFunc 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.