subscriber

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSubscriberID

func GetSubscriberID(ctx context.Context) uuid.UUID

Types

type Cache

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

func NewCache

func NewCache() *Cache

func (*Cache) GetItem

func (c *Cache) GetItem(key uuid.UUID) (*Subscriber, bool)

func (*Cache) RemoveItem

func (c *Cache) RemoveItem(key uuid.UUID)

func (*Cache) UpsertItem

func (c *Cache) UpsertItem(key uuid.UUID, value *Subscriber)

type Cacher

type Cacher interface {
	UpsertItem(key uuid.UUID, value *Subscriber)
	GetItem(key uuid.UUID) (*Subscriber, bool)
}

type ContextKey

type ContextKey string
const (
	IDKey ContextKey = "subscriber_id_key"
)

type DataProvider

type DataProvider interface {
	Create(*Subscriber) error
	Update(*Subscriber) error
	GetByID(uuid.UUID) (*Subscriber, error)
}

type Repo

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

func NewRepo

func NewRepo(conn *gorm.DB) *Repo

func (*Repo) Create

func (r *Repo) Create(item *Subscriber) error

func (*Repo) GetByID

func (r *Repo) GetByID(id uuid.UUID) (*Subscriber, error)

func (*Repo) Update

func (r *Repo) Update(item *Subscriber) error

type Server

type Server struct {
	feedpb.UnimplementedSubscriberServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(sp SubscriberProvider) *Server

func (*Server) Update

type Service

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

func NewService

func NewService(r DataProvider, c Cacher) (*Service, error)

func (*Service) Create

func (s *Service) Create(ctx context.Context, webhookURL string) (*Subscriber, error)

func (*Service) GetByID

func (s *Service) GetByID(_ context.Context, id uuid.UUID) (*Subscriber, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, item Subscriber) error

type Subscriber

type Subscriber struct {
	ID         uuid.UUID `gorm:"primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  gorm.DeletedAt `gorm:"index"`
	WebhookURL string
}

type SubscriberProvider

type SubscriberProvider interface {
	GetByID(_ context.Context, id uuid.UUID) (*Subscriber, error)
	Create(_ context.Context, webhookURL string) (*Subscriber, error)
	Update(_ context.Context, item Subscriber) error
}

Jump to

Keyboard shortcuts

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