controller

package
v0.0.0-...-86f5664 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetController

func SetController(controller CntrInterface)

func SetLogger

func SetLogger(newLogger *zap.Logger)

Types

type Cntr

type Cntr struct{}

func (Cntr) DeliverWebhook

func (control Cntr) DeliverWebhook(msg dtos.DiscordMsg) error

func (Cntr) Get

func (control Cntr) Get(pageURL string) []byte

func (Cntr) GetFormattedTime

func (control Cntr) GetFormattedTime() string

func (Cntr) GetPage

func (control Cntr) GetPage(pageURL string) *html.Node

func (Cntr) Sleep

func (control Cntr) Sleep(duration time.Duration)

func (Cntr) WriteWsMessage

func (control Cntr) WriteWsMessage(msg []byte, ws *websocket.Conn) error

type CntrInterface

type CntrInterface interface {
	// Goodreads and TheBookshop
	GetPage(url string) *html.Node
	Get(pageURL string) []byte

	// Websocket and notifications
	WriteWsMessage(msg []byte, ws *websocket.Conn) error
	DeliverWebhook(msg dtos.DiscordMsg) error

	// Utils
	GetFormattedTime() string
	Sleep(duration time.Duration)
}
var (
	Cnt CntrInterface
)

type MockCntrInterface

type MockCntrInterface struct {
	mock.Mock
}

MockCntrInterface is an autogenerated mock type for the MockCntrInterface type

func NewMockCntrInterface

func NewMockCntrInterface(t mockConstructorTestingTNewMockCntrInterface) *MockCntrInterface

NewMockCntrInterface creates a new instance of MockCntrInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockCntrInterface) DeliverWebhook

func (_m *MockCntrInterface) DeliverWebhook(msg dtos.DiscordMsg) error

DeliverWebhook provides a mock function with given fields: msg

func (*MockCntrInterface) Get

func (_m *MockCntrInterface) Get(pageURL string) []byte

GetPage provides a mock function with given fields: url

func (*MockCntrInterface) GetFormattedTime

func (_m *MockCntrInterface) GetFormattedTime() string

GetFormattedTime provides a mock function with given fields:

func (*MockCntrInterface) GetPage

func (_m *MockCntrInterface) GetPage(pageURL string) *html.Node

GetPage provides a mock function with given fields: url

func (*MockCntrInterface) Sleep

func (_m *MockCntrInterface) Sleep(duration time.Duration)

Sleep provides a mock function with given fields: duration

func (*MockCntrInterface) WriteWsMessage

func (_m *MockCntrInterface) WriteWsMessage(msg []byte, ws *websocket.Conn) error

WriteWsMessage provides a mock function with given fields: msg, ws

Jump to

Keyboard shortcuts

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