subscription

package
v0.0.0-...-ac0e98d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package subscription provides a core business API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound        = errors.New("subscription not found")
	ErrUniqueViolation = errors.New("subscription already exists")
)

Set of error variables for CRUD operations.

Functions

This section is empty.

Types

type Core

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

Core manages the set of APIs for subscription access.

func NewCore

func NewCore(log *zerolog.Logger, storer Storer) *Core

NewCore constructs a subscription core API for use.

func (*Core) Create

func (c *Core) Create(ns NewSubscription) (Subscription, error)

Create adds a new subscription to the system.

func (*Core) Delete

func (c *Core) Delete(sub Subscription) error

Delete removes the specified subscription.

func (*Core) Query

func (c *Core) Query(pageNumber int, rowsPerPage int) ([]Subscription, error)

Query retrieves a list of existing subscriptions.

func (*Core) QueryByID

func (c *Core) QueryByID(id uuid.UUID) (Subscription, error)

QueryByID finds the subscription by the specified ID.

type NewSubscription

type NewSubscription struct {
	TopicID uuid.UUID
	UserID  uuid.UUID
}

NewSubscription contains information needed to create a new subscription.

type Storer

type Storer interface {
	WithinTran(fn func(s Storer) error) error
	Create(sub Subscription) error
	Delete(sub Subscription) error
	Query(pageNumber int, rowsPerPage int) ([]Subscription, error)
	QueryByID(id uuid.UUID) (Subscription, error)
}

Storer interface declares the behavior this package needs to perists and retrieve data.

type Subscription

type Subscription struct {
	ID        uuid.UUID
	TopicID   uuid.UUID
	UserID    uuid.UUID
	CreatedAt time.Time
}

Subscription represents information about an individual subscription.

Directories

Path Synopsis
Package mocksub is a generated GoMock package.
Package mocksub is a generated GoMock package.
Package subscriptiondb contains subscription related CRUD functionality.
Package subscriptiondb contains subscription related CRUD functionality.

Jump to

Keyboard shortcuts

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