Documentation
¶
Index ¶
- Variables
- func Allowf(format string, a ...any) error
- func DecisionContext(parent context.Context, decision error) context.Context
- func DecisionFromContext(ctx context.Context) (error, bool)
- func Denyf(format string, a ...any) error
- func Skipf(format string, a ...any) error
- type AdminMutationRuleFunc
- type AdminQueryRuleFunc
- type BankAccountMutationRuleFunc
- type BankAccountQueryRuleFunc
- type ContactMutationRuleFunc
- type ContactQueryRuleFunc
- type CustomerMutationRuleFunc
- type CustomerQueryRuleFunc
- type DebtMutationRuleFunc
- type DebtQueryRuleFunc
- type EmployeeMutationRuleFunc
- type EmployeeQueryRuleFunc
- type Filter
- type FilterFunc
- type MutationPolicy
- type MutationRule
- type MutationRuleFunc
- type PartnerMutationRuleFunc
- type PartnerQueryRuleFunc
- type Policy
- type QueryMutationRule
- type QueryPolicy
- type QueryRule
- type QueryRuleFunc
- type TransactionMutationRuleFunc
- type TransactionQueryRuleFunc
Constants ¶
This section is empty.
Variables ¶
var ( // Allow may be returned by rules to indicate that the policy // evaluation should terminate with allow decision. Allow = privacy.Allow // Deny may be returned by rules to indicate that the policy // evaluation should terminate with deny decision. Deny = privacy.Deny // Skip may be returned by rules to indicate that the policy // evaluation should continue to the next rule. Skip = privacy.Skip )
Functions ¶
func DecisionContext ¶
DecisionContext creates a new context from the given parent context with a policy decision attach to it.
func DecisionFromContext ¶
DecisionFromContext retrieves the policy decision from the context.
Types ¶
type AdminMutationRuleFunc ¶
type AdminMutationRuleFunc func(context.Context, *ent.AdminMutation) error
The AdminMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (AdminMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type AdminQueryRuleFunc ¶
type AdminQueryRuleFunc func(context.Context, *ent.AdminQuery) error
The AdminQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type BankAccountMutationRuleFunc ¶
type BankAccountMutationRuleFunc func(context.Context, *ent.BankAccountMutation) error
The BankAccountMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (BankAccountMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type BankAccountQueryRuleFunc ¶
type BankAccountQueryRuleFunc func(context.Context, *ent.BankAccountQuery) error
The BankAccountQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type ContactMutationRuleFunc ¶
type ContactMutationRuleFunc func(context.Context, *ent.ContactMutation) error
The ContactMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (ContactMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type ContactQueryRuleFunc ¶
type ContactQueryRuleFunc func(context.Context, *ent.ContactQuery) error
The ContactQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type CustomerMutationRuleFunc ¶
type CustomerMutationRuleFunc func(context.Context, *ent.CustomerMutation) error
The CustomerMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (CustomerMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type CustomerQueryRuleFunc ¶
type CustomerQueryRuleFunc func(context.Context, *ent.CustomerQuery) error
The CustomerQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type DebtMutationRuleFunc ¶
type DebtMutationRuleFunc func(context.Context, *ent.DebtMutation) error
The DebtMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (DebtMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type DebtQueryRuleFunc ¶
The DebtQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type EmployeeMutationRuleFunc ¶
type EmployeeMutationRuleFunc func(context.Context, *ent.EmployeeMutation) error
The EmployeeMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (EmployeeMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type EmployeeQueryRuleFunc ¶
type EmployeeQueryRuleFunc func(context.Context, *ent.EmployeeQuery) error
The EmployeeQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type Filter ¶
Filter is the interface that wraps the Where function for filtering nodes in queries and mutations.
type FilterFunc ¶
The FilterFunc type is an adapter that allows the use of ordinary functions as filters for query and mutation types.
func (FilterFunc) EvalMutation ¶
EvalMutation calls f(ctx, q) if the mutation implements the Filter interface, otherwise it is denied.
type MutationPolicy ¶
type MutationPolicy = privacy.MutationPolicy
MutationPolicy combines multiple mutation rules into a single policy.
type MutationRule ¶
type MutationRule = privacy.MutationRule
MutationRule defines the interface which decides whether a mutation is allowed and optionally modifies 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 which allows the use of ordinary functions as mutation rules.
func (MutationRuleFunc) EvalMutation ¶
EvalMutation returns f(ctx, m).
type PartnerMutationRuleFunc ¶
type PartnerMutationRuleFunc func(context.Context, *ent.PartnerMutation) error
The PartnerMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (PartnerMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type PartnerQueryRuleFunc ¶
type PartnerQueryRuleFunc func(context.Context, *ent.PartnerQuery) error
The PartnerQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.
type QueryMutationRule ¶
type QueryMutationRule interface {
QueryRule
MutationRule
}
QueryMutationRule is an interface which 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 = privacy.QueryPolicy
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 TransactionMutationRuleFunc ¶
type TransactionMutationRuleFunc func(context.Context, *ent.TransactionMutation) error
The TransactionMutationRuleFunc type is an adapter to allow the use of ordinary functions as a mutation rule.
func (TransactionMutationRuleFunc) EvalMutation ¶
EvalMutation calls f(ctx, m).
type TransactionQueryRuleFunc ¶
type TransactionQueryRuleFunc func(context.Context, *ent.TransactionQuery) error
The TransactionQueryRuleFunc type is an adapter to allow the use of ordinary functions as a query rule.