Documentation ¶
Index ¶
- Variables
- func CreateReceiversMap(ctx context.Context, receiverService ReceiverService, ...) (map[uint64]*receiver.Receiver, error)
- func MergeConfigsMap(subscriptionConfigMap map[string]any, receiverConfigsMap map[string]any) map[string]any
- type Filter
- type LogService
- type NamespaceService
- type NotFoundError
- type Receiver
- type ReceiverService
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, sub *Subscription) error
- func (s *Service) Delete(ctx context.Context, id uint64) error
- func (s *Service) Get(ctx context.Context, id uint64) (*Subscription, error)
- func (s *Service) List(ctx context.Context, flt Filter) ([]Subscription, error)
- func (s *Service) MatchByLabels(ctx context.Context, namespaceID uint64, notificationLabels map[string]string) ([]Subscription, error)
- func (s *Service) Update(ctx context.Context, sub *Subscription) error
- type Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicate = errors.New("urn already exist") ErrRelation = errors.New("namespace id does not exist") )
Functions ¶
func CreateReceiversMap ¶
func CreateReceiversMap(ctx context.Context, receiverService ReceiverService, subscriptions []Subscription) (map[uint64]*receiver.Receiver, error)
Types ¶
type LogService ¶
type NamespaceService ¶
type NotFoundError ¶
type NotFoundError struct {
ID uint64
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type ReceiverService ¶
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService(repository Repository, logService LogService, namespaceService NamespaceService, receiverService ReceiverService) *Service
NewService returns service struct
func (*Service) MatchByLabels ¶
type Subscription ¶
type Subscription struct { ID uint64 `json:"id"` URN string `json:"urn"` Namespace uint64 `json:"namespace"` Receivers []Receiver `json:"receivers"` Match map[string]string `json:"match"` Metadata map[string]any `json:"metadata"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` CreatedBy string `json:"created_by"` UpdatedBy string `json:"updated_by"` }
func AssignReceivers ¶
func AssignReceivers(receiversMap map[uint64]*receiver.Receiver, subscriptions []Subscription) ([]Subscription, error)
func (Subscription) ReceiversAsMap ¶
func (s Subscription) ReceiversAsMap() map[uint64]Receiver
func (Subscription) SilenceReceivers ¶
Click to show internal directories.
Click to hide internal directories.