storage

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTitle = "Quotes"

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	ID            int
	Title         string
	Author        string
	SourceURL     string
	Updated       time.Time
	NumHighlights int
	LastHighlight time.Time
}

type Highlight

type Highlight struct {
	BookID   int
	ID       int
	Text     string
	Note     string
	Chapter  string
	Location int
	URL      string
	Updated  time.Time
}

type Storage

type Storage interface {
	// AddBook adds a new book to the storage. If the book already exists, it returns the
	// existing book.
	AddBook(ctx context.Context, title, author, source string) (Book, error)

	// AddHighlight adds a new highlight to the storage. If the highlight already exists,
	// it returns the existing highlight.
	AddHighlight(ctx context.Context, b Book, text, note, chapter string, location int, url string) (Highlight, error)

	// ListBooks returns a list of books from the storage.
	ListBooks(ctx context.Context, lt, gt time.Time) ([]Book, error)

	// ListHighlights returns a list of highlights from the storage.
	ListHighlights(ctx context.Context, lt, gt time.Time) ([]Highlight, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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