Documentation ¶
Index ¶
- Variables
- func ClassifyReceivers(newReceiver []subscriptionreceiver.Relation, ...) (toUpsert []subscriptionreceiver.Relation, ...)
- type Filter
- type LogService
- type NamespaceService
- type NotFoundError
- type Receiver
- type ReceiverService
- type ReceiverView
- type Repository
- type Service
- func (s *Service) CreateV2(ctx context.Context, sub *Subscription) error
- func (s *Service) DeleteV2(ctx context.Context, id uint64) error
- func (s *Service) GetV2(ctx context.Context, id uint64) (*Subscription, error)
- func (s *Service) ListV2(ctx context.Context, flt Filter) ([]Subscription, error)
- func (s *Service) MatchByLabelsV2(ctx context.Context, namespaceID uint64, notificationLabels map[string]string) ([]ReceiverView, error)
- func (s *Service) UpdateV2(ctx context.Context, sub *Subscription) error
- type Subscription
- type SubscriptionReceiverService
- type Transactor
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 ClassifyReceivers ¶ added in v0.7.5
func ClassifyReceivers(newReceiver []subscriptionreceiver.Relation, existingReceiver []subscriptionreceiver.Relation) (toUpsert []subscriptionreceiver.Relation, toDelete []subscriptionreceiver.Relation)
ClassifyReceivers compare existing and new receivers of a subscription
Types ¶
type LogService ¶
type NamespaceService ¶
type NotFoundError ¶
type NotFoundError struct {
ID uint64
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type ReceiverService ¶
type ReceiverView ¶ added in v0.7.5
type ReceiverView struct { ID uint64 `json:"id"` // receiver_id Name string `json:"name"` Labels map[string]string `json:"labels"` Type string `json:"type"` Configurations map[string]any `json:"configurations"` ParentID uint64 `json:"parent_id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` SubscriptionID uint64 `json:"subscription_id"` Match map[string]string `json:"match"` }
func (*ReceiverView) FromReceiver ¶ added in v0.7.6
func (rcv *ReceiverView) FromReceiver(r receiver.Receiver)
type Repository ¶
type Repository interface { Transactor List(context.Context, Filter) ([]Subscription, error) Create(context.Context, *Subscription) error Get(context.Context, uint64) (*Subscription, error) Update(context.Context, *Subscription) error Delete(context.Context, uint64) error MatchLabelsFetchReceivers(ctx context.Context, flt Filter) ([]ReceiverView, error) }
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, subscriptionReceiverService SubscriptionReceiverService, ) *Service
NewService returns service struct
func (*Service) CreateV2 ¶ added in v0.7.5
func (s *Service) CreateV2(ctx context.Context, sub *Subscription) error
func (*Service) MatchByLabelsV2 ¶ added in v0.7.5
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"` // for v1 api cases ReceiversRelation []subscriptionreceiver.Relation `json:"receivers_relation"` }
func (Subscription) ReceiversAsMap ¶
func (s Subscription) ReceiversAsMap() map[uint64]Receiver
func (Subscription) SilenceReceivers ¶
type SubscriptionReceiverService ¶ added in v0.7.5
type SubscriptionReceiverService interface { List(context.Context, subscriptionreceiver.Filter) ([]subscriptionreceiver.Relation, error) BulkCreate(context.Context, []subscriptionreceiver.Relation) error BulkUpsert(context.Context, []subscriptionreceiver.Relation) error BulkSoftDelete(context.Context, subscriptionreceiver.DeleteFilter) error BulkDelete(context.Context, subscriptionreceiver.DeleteFilter) error }
Click to show internal directories.
Click to hide internal directories.