service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProviderNotFound = errors.New("provider not found")
	ErrLinkNotFound     = errors.New("link not found in message")
	ErrLinksNotFound    = errors.New("links not found")
	ErrHasAlreadyShare  = errors.New("already share it")
)

Functions

func NewTelegramHandler added in v1.0.0

func NewTelegramHandler(svc Service) telegram.Handler

Types

type Link struct {
	URL  string
	Name string
}

type Message

type Message struct {
	URL    string `bson:"url"`
	Title  string `bson:"title"`
	Links  []Link `bson:"links,omitempty"`
	UserID int    `bson:"user_id"`
}

type Service

type Service interface {
	FindLinks(ctx context.Context, m *Message) (*Message, error)
	GetList(ctx context.Context, userID int) (string, error)
}

func NewLoggingService

func NewLoggingService(ctx context.Context, s Service) Service

func NewService

func NewService(s Store, providers ...provider.Provider) Service

type Store

type Store interface {
	Save(ctx context.Context, m *Message) error
	FindByURL(ctx context.Context, url string) (*Message, error)
	FindByUser(ctx context.Context, userID int) ([]Message, error)
}

func NewStoreMock

func NewStoreMock() Store

Jump to

Keyboard shortcuts

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