quotes

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Quote

type Quote struct {
	Quote string    `json:"quote"`
	UUID  uuid.UUID `json:"uuid"`
	Score int       `json:"score"`
	// contains filtered or unexported fields
}

Quote describes a quote.

type Repository

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

Repository represents a storage abstraction Cf. https://www.martinfowler.com/eaaCatalog/repository.html

func NewRepository

func NewRepository(db database.Database) Repository

NewRepository initialises a new repo, for interacting with storage

func (Repository) All

func (r Repository) All() []Quote

All returns all quotes

func (Repository) AllByWord

func (r Repository) AllByWord(w string) []Quote

AllByWord returns all quotes containing a specific word

func (Repository) DecrementsScore

func (r Repository) DecrementsScore(u string) error

@TODO : check existence, error message

func (Repository) FindByUUID

func (r Repository) FindByUUID(u string) *Quote

FindByUUID returns one quote, given its UUID

func (Repository) IncrementsScore

func (r Repository) IncrementsScore(u string) error

func (Repository) Preferred

func (r Repository) Preferred() []Quote

Preferred returns 5 preferred quotes

func (Repository) Random

func (r Repository) Random() *Quote

Random returns one quote, randomly

Jump to

Keyboard shortcuts

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