model

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

func NewModel

func NewModel(dbType, dbPath string) (m Model, err error)

NewModel creates a new model with a DB connection to the give dbPath (currently sqlite)

func (Model) AddQuote

func (m Model) AddQuote(q Quote) (err error)

func (Model) Close

func (m Model) Close() error

func (Model) CountAllQuotes

func (m Model) CountAllQuotes() (count int, err error)

func (Model) CountQuotes

func (m Model) CountQuotes(q Query) (count int, err error)

func (Model) DeleteQuote

func (m Model) DeleteQuote(id int) (err error)

func (Model) GetPopularTags added in v0.1.2

func (m Model) GetPopularTags(n int) (tags []string, err error)

func (Model) GetQuote

func (m Model) GetQuote(id int) (quote Quote, err error)

func (Model) GetQuotes

func (m Model) GetQuotes(q Query) (quotes []Quote, err error)

func (Model) VoteQuote

func (m Model) VoteQuote(id int, vote int) (err error)

type Query

type Query struct {
	Search      string
	Limit       int
	Offset      int
	OrderBy     []string
	MaxLines    int
	IncludeTags []string
	ExcludeTags []string
}

func (Query) WhereClause

func (q Query) WhereClause() string

type Quote

type Quote struct {
	ID          int       `json:"id"`
	Text        string    `json:"text"`
	Score       int       `json:"score"`
	TimeCreated time.Time `json:"time_created"`
	Tags        []string  `json:"tags"`
}

Jump to

Keyboard shortcuts

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