impl

package
v0.0.0-...-c229084 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAgentRepo

func NewAgentRepo(db *mongo.Database) repository.AgentRepo

func NewAuditLogRepo

func NewAuditLogRepo(db *mongo.Database) repository.AuditLogRepo

NewAuditLogRepo 创建一个 审计日志仓库

func NewDingdingRobotRepo

func NewDingdingRobotRepo(db *mongo.Database) repository.DingdingRobotRepo

func NewEventRelationNoteRepo

func NewEventRelationNoteRepo(db *mongo.Database) repository.EventRelationNoteRepo

func NewEventRelationRepo

func NewEventRelationRepo(db *mongo.Database) repository.EventRelationRepo

func NewEventRepo

func NewEventRepo(db *mongo.Database, seqRepo repository.SequenceRepo) repository.EventRepo

func NewKVRepo

func NewKVRepo(db *mongo.Database) repository.KVRepo

func NewLockRepo

func NewLockRepo(db *mongo.Database) repository.LockRepo

func NewQueueRepo

func NewQueueRepo(db *mongo.Database) repository.QueueRepo

func NewRecoveryRepo

func NewRecoveryRepo(db *mongo.Database) repository.RecoveryRepo

func NewRuleRepo

func NewRuleRepo(db *mongo.Database) repository.RuleRepo

func NewSequenceRepo

func NewSequenceRepo(db *mongo.Database) repository.SequenceRepo

func NewTemplateRepo

func NewTemplateRepo(db *mongo.Database) repository.TemplateRepo

func NewUserRepo

func NewUserRepo(db *mongo.Database) repository.UserRepo

Types

type AgentRepo

type AgentRepo struct {
	// contains filtered or unexported fields
}

func (AgentRepo) Delete

func (a AgentRepo) Delete(filter bson.M) error

func (AgentRepo) DeleteID

func (a AgentRepo) DeleteID(id repository.ID) error

func (AgentRepo) Find

func (a AgentRepo) Find(filter bson.M) (agents []repository.Agent, err error)

func (AgentRepo) Get

func (a AgentRepo) Get(id repository.ID) (agent repository.Agent, err error)

func (AgentRepo) Update

func (a AgentRepo) Update(agent repository.Agent) (repository.ID, error)

type AuditLogRepo

type AuditLogRepo struct {
	// contains filtered or unexported fields
}

AuditLogRepo 审计日志仓库

func (*AuditLogRepo) Add

func (alr *AuditLogRepo) Add(al repository.AuditLog) (id primitive.ObjectID, err error)

Add 添加日志

func (*AuditLogRepo) Delete

func (alr *AuditLogRepo) Delete(filter bson.M) error

Delete 删除

func (*AuditLogRepo) DeleteID

func (alr *AuditLogRepo) DeleteID(id primitive.ObjectID) error

DeleteID 删除单条

func (*AuditLogRepo) Get

func (alr *AuditLogRepo) Get(id primitive.ObjectID) (al repository.AuditLog, err error)

Get 查询单个日志

func (*AuditLogRepo) Paginate

func (alr *AuditLogRepo) Paginate(filter bson.M, offset, limit int64) (als []repository.AuditLog, next int64, err error)

Paginate 分页查询

type DingdingRobotRepo

type DingdingRobotRepo struct {
	// contains filtered or unexported fields
}

func (DingdingRobotRepo) Add

func (DingdingRobotRepo) Count

func (u DingdingRobotRepo) Count(filter bson.M) (int64, error)

func (DingdingRobotRepo) Delete

func (u DingdingRobotRepo) Delete(filter bson.M) error

func (DingdingRobotRepo) DeleteID

func (u DingdingRobotRepo) DeleteID(id primitive.ObjectID) error

func (DingdingRobotRepo) Find

func (u DingdingRobotRepo) Find(filter bson.M) (robots []repository.DingdingRobot, err error)

func (DingdingRobotRepo) Get

func (DingdingRobotRepo) Paginate

func (u DingdingRobotRepo) Paginate(filter bson.M, offset, limit int64) (robots []repository.DingdingRobot, next int64, err error)

func (DingdingRobotRepo) Update

type EventGroupRepo

type EventGroupRepo struct {
	// contains filtered or unexported fields
}

func (EventGroupRepo) Add

func (EventGroupRepo) CollectingGroup

func (m EventGroupRepo) CollectingGroup(rule repository.EventGroupRule) (group repository.EventGroup, err error)

func (EventGroupRepo) Count

func (m EventGroupRepo) Count(filter bson.M) (int64, error)

func (EventGroupRepo) Delete

func (m EventGroupRepo) Delete(filter bson.M) error

func (EventGroupRepo) DeleteID

func (m EventGroupRepo) DeleteID(id primitive.ObjectID) error

func (EventGroupRepo) Find

func (m EventGroupRepo) Find(filter bson.M) (grps []repository.EventGroup, err error)

func (EventGroupRepo) Get

func (EventGroupRepo) LastGroup

func (m EventGroupRepo) LastGroup(filter bson.M) (grp repository.EventGroup, err error)

func (EventGroupRepo) Paginate

func (m EventGroupRepo) Paginate(filter bson.M, offset, limit int64) (grps []repository.EventGroup, next int64, err error)

func (EventGroupRepo) StatByAggCount

func (m EventGroupRepo) StatByAggCount(ctx context.Context, ruleID primitive.ObjectID, startTime, endTime time.Time) ([]repository.EventGroupAggCount, error)

func (EventGroupRepo) StatByAggCountInPeriod

func (m EventGroupRepo) StatByAggCountInPeriod(ctx context.Context, ruleID primitive.ObjectID, startTime, endTime time.Time, hour int64) ([]repository.EventGroupAggByDatetimeCount, error)

func (EventGroupRepo) StatByDatetimeCount

func (m EventGroupRepo) StatByDatetimeCount(ctx context.Context, filter bson.M, startTime, endTime time.Time, hour int64) ([]repository.EventGroupByDatetimeCount, error)

func (EventGroupRepo) StatByRuleCount

func (m EventGroupRepo) StatByRuleCount(ctx context.Context, startTime, endTime time.Time) ([]repository.EventGroupByRuleCount, error)

func (EventGroupRepo) StatByUserCount

func (m EventGroupRepo) StatByUserCount(ctx context.Context, startTime, endTime time.Time) ([]repository.EventGroupByUserCount, error)

func (EventGroupRepo) Traverse

func (m EventGroupRepo) Traverse(filter bson.M, cb func(grp repository.EventGroup) error) error

func (EventGroupRepo) UpdateID

type EventRelationNoteRepo

type EventRelationNoteRepo struct {
	// contains filtered or unexported fields
}

func (*EventRelationNoteRepo) AddNote

func (*EventRelationNoteRepo) DeleteNote

func (m *EventRelationNoteRepo) DeleteNote(ctx context.Context, relID primitive.ObjectID, filter bson.M) error

func (*EventRelationNoteRepo) PaginateNotes

func (m *EventRelationNoteRepo) PaginateNotes(ctx context.Context, relID primitive.ObjectID, filter bson.M, offset, limit int64) (notes []repository.EventRelationNote, next int64, err error)

type EventRelationRepo

type EventRelationRepo struct {
	// contains filtered or unexported fields
}

func (*EventRelationRepo) AddOrUpdateEventRelation

func (m *EventRelationRepo) AddOrUpdateEventRelation(ctx context.Context, summary string, matchedRuleID primitive.ObjectID) (eventRel repository.EventRelation, err error)

func (*EventRelationRepo) Count

func (m *EventRelationRepo) Count(ctx context.Context, filter interface{}) (int64, error)

func (*EventRelationRepo) Get

func (*EventRelationRepo) Paginate

func (m *EventRelationRepo) Paginate(ctx context.Context, filter interface{}, offset, limit int64) (eventRels []repository.EventRelation, next int64, err error)

type EventRepo

type EventRepo struct {
	// contains filtered or unexported fields
}

func (EventRepo) Add

func (m EventRepo) Add(msg repository.Event) (id primitive.ObjectID, err error)

func (EventRepo) AddWithContext

func (m EventRepo) AddWithContext(ctx context.Context, msg repository.Event) (id primitive.ObjectID, err error)

func (EventRepo) Count

func (m EventRepo) Count(filter interface{}) (int64, error)

func (EventRepo) CountByDatetime

func (m EventRepo) CountByDatetime(ctx context.Context, filter bson.M, startTime, endTime time.Time, hour int64) ([]repository.EventByDatetimeCount, error)

func (EventRepo) Delete

func (m EventRepo) Delete(filter interface{}) error

func (EventRepo) DeleteID

func (m EventRepo) DeleteID(id primitive.ObjectID) error

func (EventRepo) Find

func (m EventRepo) Find(filter interface{}) (messages []repository.Event, err error)

func (EventRepo) FindIDs

func (m EventRepo) FindIDs(ctx context.Context, filter interface{}, limit int64) ([]primitive.ObjectID, error)

func (EventRepo) Get

func (m EventRepo) Get(id primitive.ObjectID) (msg repository.Event, err error)

func (EventRepo) Paginate

func (m EventRepo) Paginate(filter interface{}, offset, limit int64) (messages []repository.Event, next int64, err error)

func (EventRepo) Traverse

func (m EventRepo) Traverse(filter interface{}, cb func(msg repository.Event) error) error

func (EventRepo) UpdateID

func (m EventRepo) UpdateID(id primitive.ObjectID, update repository.Event) error

type KVRepo

type KVRepo struct {
	// contains filtered or unexported fields
}

func (KVRepo) All

func (repo KVRepo) All(filter bson.M) (pairs []repository.KV, err error)

func (KVRepo) GC

func (repo KVRepo) GC() error

func (KVRepo) Get

func (repo KVRepo) Get(key string) (pair repository.KV, err error)

func (KVRepo) Remove

func (repo KVRepo) Remove(key string) (removeCount int64, err error)

func (KVRepo) Set

func (repo KVRepo) Set(key string, value interface{}) error

func (KVRepo) SetWithTTL

func (repo KVRepo) SetWithTTL(key string, value interface{}, ttl time.Duration) error

type LockRepo

type LockRepo struct {
	// contains filtered or unexported fields
}

func (*LockRepo) Lock

func (l *LockRepo) Lock(resource string, owner string, ttl uint) (*repository.Lock, error)

Lock acquire a lock One of three things will happen when we run this change (upsert).

  1. If the resource exists and has any locks on it (shared or exclusive), we will get a duplicate key error.
  2. If the resource exists but doesn't have any locks on it, we will update it to obtain an exclusive lock.
  3. If the resource doesn't exist yet, it will be inserted which will give us an exclusive lock on it.

func (*LockRepo) Remove

func (l *LockRepo) Remove(resource string) error

func (*LockRepo) Renew

func (l *LockRepo) Renew(lockID primitive.ObjectID, ttl uint) (*repository.Lock, error)

func (*LockRepo) UnLock

func (l *LockRepo) UnLock(lockID primitive.ObjectID) error

type QueueRepo

type QueueRepo struct {
	// contains filtered or unexported fields
}

func (*QueueRepo) Count

func (q *QueueRepo) Count(filter bson.M) (int64, error)

func (*QueueRepo) Delete

func (q *QueueRepo) Delete(filter bson.M) error

func (*QueueRepo) DeleteID

func (q *QueueRepo) DeleteID(id primitive.ObjectID) error

func (*QueueRepo) Dequeue

func (q *QueueRepo) Dequeue(ctx context.Context) (item repository.QueueJob, err error)

func (*QueueRepo) Enqueue

func (q *QueueRepo) Enqueue(ctx context.Context, item repository.QueueJob) (id primitive.ObjectID, err error)

func (*QueueRepo) Get

func (*QueueRepo) Paginate

func (q *QueueRepo) Paginate(filter bson.M, offset, limit int64) (items []repository.QueueJob, next int64, err error)

func (*QueueRepo) Update

func (q *QueueRepo) Update(ctx context.Context, filter bson.M, item repository.QueueJob) error

func (*QueueRepo) UpdateID

func (q *QueueRepo) UpdateID(ctx context.Context, id primitive.ObjectID, jobItem repository.QueueJob) error

type RecoveryRepo

type RecoveryRepo struct {
	// contains filtered or unexported fields
}

func (RecoveryRepo) Delete

func (r RecoveryRepo) Delete(ctx context.Context, recoveryID string) error

func (RecoveryRepo) RecoverableEvents

func (r RecoveryRepo) RecoverableEvents(ctx context.Context, deadline time.Time) ([]repository.Recovery, error)

func (RecoveryRepo) Register

func (r RecoveryRepo) Register(ctx context.Context, recoveryAt time.Time, recoveryID string, refID primitive.ObjectID) error

type RuleRepo

type RuleRepo struct {
	// contains filtered or unexported fields
}

func (RuleRepo) Add

func (r RuleRepo) Add(rule repository.Rule) (id primitive.ObjectID, err error)

func (RuleRepo) Count

func (r RuleRepo) Count(filter bson.M) (int64, error)

func (RuleRepo) Delete

func (r RuleRepo) Delete(filter bson.M) error

func (RuleRepo) DeleteID

func (r RuleRepo) DeleteID(id primitive.ObjectID) error

func (RuleRepo) Find

func (r RuleRepo) Find(filter bson.M) (rules []repository.Rule, err error)

func (RuleRepo) Get

func (r RuleRepo) Get(id primitive.ObjectID) (rule repository.Rule, err error)

func (RuleRepo) Paginate

func (r RuleRepo) Paginate(filter interface{}, offset, limit int64) (rules []repository.Rule, next int64, err error)

func (RuleRepo) Tags

func (r RuleRepo) Tags(ctx context.Context) ([]repository.Tag, error)

func (RuleRepo) Traverse

func (r RuleRepo) Traverse(filter bson.M, cb func(rule repository.Rule) error) error

func (RuleRepo) UpdateID

func (r RuleRepo) UpdateID(id primitive.ObjectID, rule repository.Rule) error

type SequenceRepo

type SequenceRepo struct {
	// contains filtered or unexported fields
}

func (SequenceRepo) Next

func (s SequenceRepo) Next(name string) (seq repository.Sequence, err error)

func (SequenceRepo) Truncate

func (s SequenceRepo) Truncate(name string) error

type ServiceProvider

type ServiceProvider struct{}

func (ServiceProvider) Boot

func (s ServiceProvider) Boot(app infra.Glacier)

func (ServiceProvider) Register

func (s ServiceProvider) Register(app container.Container)

type TemplateRepo

type TemplateRepo struct {
	// contains filtered or unexported fields
}

func (TemplateRepo) Add

func (t TemplateRepo) Add(temp repository.Template) (id primitive.ObjectID, err error)

func (TemplateRepo) Count

func (t TemplateRepo) Count(filter bson.M) (int64, error)

func (TemplateRepo) Delete

func (t TemplateRepo) Delete(filter bson.M) error

func (TemplateRepo) DeleteID

func (t TemplateRepo) DeleteID(id primitive.ObjectID) error

func (TemplateRepo) Find

func (t TemplateRepo) Find(filter bson.M) (templates []repository.Template, err error)

func (TemplateRepo) Get

func (t TemplateRepo) Get(id primitive.ObjectID) (temp repository.Template, err error)

func (TemplateRepo) Paginate

func (t TemplateRepo) Paginate(filter bson.M, offset, limit int64) (templates []repository.Template, next int64, err error)

func (TemplateRepo) Update

type UserRepo

type UserRepo struct {
	// contains filtered or unexported fields
}

func (UserRepo) Add

func (u UserRepo) Add(user repository.User) (id primitive.ObjectID, err error)

func (UserRepo) Count

func (u UserRepo) Count(filter bson.M) (int64, error)

func (UserRepo) Delete

func (u UserRepo) Delete(filter bson.M) error

func (UserRepo) DeleteID

func (u UserRepo) DeleteID(id primitive.ObjectID) error

func (UserRepo) Find

func (u UserRepo) Find(filter bson.M) (users []repository.User, err error)

func (UserRepo) Get

func (u UserRepo) Get(id primitive.ObjectID) (user repository.User, err error)

func (UserRepo) GetByEmail

func (u UserRepo) GetByEmail(email string) (user repository.User, err error)

func (UserRepo) GetUserMetas

func (u UserRepo) GetUserMetas(queryK, queryV, field string) ([]string, error)

func (UserRepo) Paginate

func (u UserRepo) Paginate(filter bson.M, offset, limit int64) (users []repository.User, next int64, err error)

func (UserRepo) Update

func (u UserRepo) Update(id primitive.ObjectID, user repository.User) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL