truncated

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandFinder

func ExpandFinder(tf IDFinder, l note.Loader) note.Finder

ExpandFinder combines tf and l to provide a note.Finder implementation.

func ExpandLoader

func ExpandLoader(tl TruncatedLoader) note.Loader

ExpandLoader expands tl into a Loader implementation with a simple built-in cache that is suitable for short-lived loaders.

Types

type IDFinder

type IDFinder interface {
	// FindNoteIDs returns ids: the ID of every note that matches q. If q
	// specifies an ordering, FindNoteIDs should return ids in that order.
	FindNoteIDs(q *note.Query) (ids []note.ID, err error)
}

IDFinder can be implemented in order to provide a note.Finder through ExpandFinder.

type TruncatedLoader

type TruncatedLoader interface {
	// LoadTruncatedNotes should return tns where len(tns)==len(ids) and, for
	// each offset into ids, tns[offset].ID==ids[offset].
	//
	// Implementations should return note.InvalidID if any ID in ids is empty.
	//
	// Since all notes implicitly exist, there is no "not found" error: for any
	// ID x where nothing is known about x, implementations should return
	// TruncatedNote{ID:x}.
	LoadTruncatedNotes(ids []note.ID) (tns []note.TruncatedNote, err error)
}

TruncatedLoader can be implemented in order to provide a Loader through ExpandLoader.

Jump to

Keyboard shortcuts

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