Documentation ¶
Index ¶
- type Quote
- type Repository
- func (r Repository) All() []Quote
- func (r Repository) AllByWord(w string) []Quote
- func (r Repository) DecrementsScore(u string) error
- func (r Repository) FindByUUID(u string) *Quote
- func (r Repository) IncrementsScore(u string) error
- func (r Repository) Preferred() []Quote
- func (r Repository) Random() *Quote
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) 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
Click to show internal directories.
Click to hide internal directories.