subscriptionreceiver

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate = errors.New("subscription id and receiver id already registered")
	ErrRelation  = errors.New("subscription or receiver id does not exist")
)

Functions

This section is empty.

Types

type DeleteFilter

type DeleteFilter struct {
	Pair           []Relation
	SubscriptionID uint64
}

type Filter

type Filter struct {
	SubscriptionIDs []uint64
	ReceiverID      uint64
	Labels          map[string]string
	Deleted         bool
}

type NotFoundError

type NotFoundError struct {
	SubscriptionID uint64
	ReceiverID     uint64
	ErrStr         string
}

func (NotFoundError) Error

func (err NotFoundError) Error() string

type Relation

type Relation struct {
	ID             uint64            `json:"id"`
	SubscriptionID uint64            `json:"subscription_id"`
	ReceiverID     uint64            `json:"receiver_id"`
	Labels         map[string]string `json:"labels"`
	CreatedAt      time.Time         `json:"created_at"`
	UpdatedAt      time.Time         `json:"updated_at"`
	DeletedAt      time.Time         `json:"deleted_at"`
}

type Repository

type Repository interface {
	List(context.Context, Filter) ([]Relation, error)
	BulkCreate(context.Context, []Relation) error
	BulkUpsert(context.Context, []Relation) error
	Update(context.Context, *Relation) error
	BulkSoftDelete(ctx context.Context, flt DeleteFilter) error
	BulkDelete(ctx context.Context, flt DeleteFilter) error
}

type Service

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

Service handles business logic

func NewService

func NewService(
	repository Repository,
) *Service

NewService returns service struct

func (*Service) BulkCreate

func (s *Service) BulkCreate(ctx context.Context, rels []Relation) error

func (*Service) BulkDelete

func (s *Service) BulkDelete(ctx context.Context, flt DeleteFilter) error

func (*Service) BulkSoftDelete

func (s *Service) BulkSoftDelete(ctx context.Context, flt DeleteFilter) error

func (*Service) BulkUpsert

func (s *Service) BulkUpsert(ctx context.Context, rels []Relation) error

func (*Service) List

func (s *Service) List(ctx context.Context, flt Filter) ([]Relation, error)

func (*Service) Update added in v0.7.6

func (s *Service) Update(ctx context.Context, rel *Relation) error

type Transactor

type Transactor interface {
	WithTransaction(ctx context.Context) context.Context
	Rollback(ctx context.Context, err error) error
	Commit(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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