steno

package
v0.0.0-...-5c30f4a Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

README

This is the core steno package, without gui dependencies. To build a gui app, see ../cmd/steno

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slurp

func Slurp(db *store.Store, server *SlurpSource, timeFrom, timeTo time.Time, progressFn func(fetchedCnt int, expectedCnt int, newCnt int, msg string)) (store.ArtList, error)

returns IDs of sucessfully-added articles

Types

type Facet

type Facet struct {
	Txt string
	Cnt int
}

type FileLog

type FileLog struct {
	// contains filtered or unexported fields
}

func NewLog

func NewLog(logFile string) (*FileLog, error)

func (*FileLog) Close

func (d *FileLog) Close()

func (*FileLog) Printf

func (d *FileLog) Printf(format string, v ...interface{})

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

type NullLogger

type NullLogger struct{}

func (NullLogger) Printf

func (l NullLogger) Printf(format string, v ...interface{})

type Results

type Results struct {
	Query string
	Arts  store.ArtList
	Len   int

	FacetLen int
	// contains filtered or unexported fields
}

Results holds the results of a query. It holds a list of article IDs, with methods to fetch full articles from the store on demand.

func NewResults

func NewResults(db *store.Store, query string) (*Results, error)

func (*Results) Art

func (res *Results) Art(idx int) *store.Article

TODO: make db access explict! + proper error handling

func (*Results) Dehydrate

func (res *Results) Dehydrate(artIDs store.ArtList)

Dehydrate removes artIDs from cache, forcing them to be fetched from db next time.

func (*Results) Facet

func (res *Results) Facet(idx int) *Facet

func (*Results) FindForward

func (res *Results) FindForward(artIdx int, needle string) int

func (*Results) FindReverse

func (res *Results) FindReverse(artIdx int, needle string) int

func (*Results) HighlightTerms

func (res *Results) HighlightTerms() string

return terms from current query, for highlighting eg if query is `chaos headline:"climate change"`, this fn should return "chaos","climate change". or something. TODO: should really fall out of query parsing...

func (*Results) Match

func (res *Results) Match(artIdx int, needle string) bool

func (*Results) Sort

func (res *Results) Sort(sortColumn string, sortOrder int) *Results

type SlurpSource

type SlurpSource struct {
	Name string
	Loc  string
}

func LoadSlurpSources

func LoadSlurpSources(fileName string) ([]SlurpSource, error)

Jump to

Keyboard shortcuts

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