webserver

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(idx Reader, libraryPath, homeDir, version string, metadataReaders map[string]metadata.Reader, coverMaxWidth int, sender Sender) *fiber.App

New builds a new Fiber application and set up the required routes

Types

type Page

type Page struct {
	Link      string
	IsCurrent bool
}

Page holds the URL of a results page, and if that page is the current one being shown

type PagesNavigator

type PagesNavigator struct {
	Pages        map[int]Page
	PreviousLink string
	NextLink     string
}

PagesNavigator contains all pages links, as well as links to the previous and next pages from the current one

type Reader added in v1.2.0

type Reader interface {
	Search(keywords string, page, resultsPerPage int) (*Result, error)
	Count() (uint64, error)
	Close() error
}

Reader defines a set of reading operations over an index

type ReaderMock added in v1.2.0

type ReaderMock struct {
	SearchFake func(keywords string, page, resultsPerPage int) (*Result, error)
	CountFake  func() (uint64, error)
	CloseFake  func() error
}

ReaderMock implements the Reader interface with a mockable struct. Just assign to each *Fake property the function you want to execute

func NewReaderMock added in v1.2.0

func NewReaderMock() *ReaderMock

NewReaderMock returns a new instance of ReaderMock

func (*ReaderMock) Close added in v1.2.0

func (r *ReaderMock) Close() error

Close runs the faked close method contained in the instance

func (*ReaderMock) Count added in v1.2.0

func (r *ReaderMock) Count() (uint64, error)

Count runs the faked count method contained in the instance

func (*ReaderMock) Search added in v1.2.0

func (r *ReaderMock) Search(keywords string, page, resultsPerPage int) (*Result, error)

Search runs the faked search method contained in the instance

type Result added in v1.2.0

type Result struct {
	Page       int
	TotalPages int
	Hits       []metadata.Metadata
	TotalHits  int
}

Result holds the result of a search request, as well as some related metadata

type Sender added in v1.1.0

type Sender interface {
	SendDocument(address string, libraryPath string, fileName string) error
}

Jump to

Keyboard shortcuts

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