service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProviderNotFound = errors.New("provider not found")
)

Functions

func MakeBotHandler

func MakeBotHandler(s Service, logger log.Logger) bot.Handler

Types

type FindLinksRequest

type FindLinksRequest struct {
	URL      string
	Username string
}

type FindLinksResponse

type FindLinksResponse struct {
	Links []string
	Err   error
}

type GetListRequest

type GetListRequest struct {
	Username string
}

type GetListResponse

type GetListResponse struct {
	Msg string
	Err error
}

type Message

type Message struct {
	URL      string   `bson:"url"`
	Title    string   `bson:"title"`
	Links    []string `bson:"links,omitempty"`
	Username string   `bson:"username"`
}

type Service

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

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

NewLoggingService returns a new instance of a logging Service.

func NewService

func NewService(s Store, p map[string]provider.Provider, logger log.Logger) Service

type Store

type Store interface {
	Save(ctx context.Context, m *Message) error
	FindByURL(ctx context.Context, url string) (*Message, error)
	FindByUsername(ctx context.Context, username string) ([]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