feat: 新增预警定时扫描器,移除附件归档字段并为角色表补充更新时间
This commit is contained in:
@@ -8,6 +8,30 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// The AlertFunc type is an adapter to allow the use of ordinary
|
||||
// function as Alert mutator.
|
||||
type AlertFunc func(context.Context, *ent.AlertMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f AlertFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.AlertMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AlertMutation", m)
|
||||
}
|
||||
|
||||
// The AlertRuleFunc type is an adapter to allow the use of ordinary
|
||||
// function as AlertRule mutator.
|
||||
type AlertRuleFunc func(context.Context, *ent.AlertRuleMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f AlertRuleFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.AlertRuleMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AlertRuleMutation", m)
|
||||
}
|
||||
|
||||
// The AttachmentFunc type is an adapter to allow the use of ordinary
|
||||
// function as Attachment mutator.
|
||||
type AttachmentFunc func(context.Context, *ent.AttachmentMutation) (ent.Value, error)
|
||||
|
||||
Reference in New Issue
Block a user