link

package
v0.0.0-...-f22efe6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 20 Imported by: 0

README

Documentation

Overview

Link UC. Application layer

Index

Constants

This section is empty.

Variables

View Source
var ErrCreateLink = errors.New("error create a new link")

Functions

func NewLinkHistogramObserve

func NewLinkHistogramObserve(ctx context.Context)

Types

type NotFoundByHash

type NotFoundByHash struct {
	Hash string
}

NotFoundByHash is an error when the link is not found by hash

func (NotFoundByHash) Error

func (e NotFoundByHash) Error() string

type UC

type UC struct {
	// Observer interface for subscribe on system event
	notify.Subscriber[domain.Link]
	// contains filtered or unexported fields
}

func New

func New(log logger.Logger, dataBus mq.MQ, metadataService any, store crud.Repository, permissionClient *authzed.Client) (*UC, error)

func (*UC) Add

func (uc *UC) Add(ctx context.Context, in *domain.Link) (*domain.Link, error)

Add - create a new link

Saga: 1. Save to store 2. Add permission 3. Get metadata 4. Publish event

func (*UC) Delete

func (uc *UC) Delete(ctx context.Context, hash string) (*domain.Link, error)

Delete - delete link

Saga: 1. Check permission 2. Delete from store

func (*UC) Get

func (uc *UC) Get(ctx context.Context, hash string) (*domain.Link, error)

Get - get a link by hash

Saga: 1. Check permission 2. Get a link from store

func (*UC) List

func (uc *UC) List(ctx context.Context, filter *types.FilterLink, cursor string, limit uint32) (*domain.Links, *string, error)

List - get a list of links

Saga: 1. Check permission 2. Get a list of links from store

func (*UC) Update

func (uc *UC) Update(ctx context.Context, in *domain.Link) (*domain.Link, error)

Jump to

Keyboard shortcuts

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