Documentation ¶
Index ¶
- Constants
- func AttachFilter(db *sql.DB, userID int64, filterID int64) (int64, error)
- func DetachFilter(db *sql.DB, userID int64, filterID int64) (int64, error)
- func GetIDsFromTags(db *sql.DB, tags string) []int
- func LoginUser(db *sql.DB, username string, password string) (string, error)
- func PostFilter(db *sql.DB, filter string, userID int64) (int64, error)
- func PostUser(db *sql.DB, email string, username string, password string) (int64, error)
- func Subscribe(db *sql.DB, sectionID int64, userID int64, subscribe bool) (int64, error)
- type Filter
- type FilterCollection
- type News
- type Newspaper
- type Newspapers
- type Section
- type Sections
Constants ¶
const NewsByID = `SELECT s.rss, s.name, n.name FROM section s INNER JOIN newspaper n ON(s.newspaper_id = n.id) WHERE s.id=?1`
NewsByID returns a RSS url for a section.id
const NewspaperByID = `SELECT n.id, n.name, c.name, c.code FROM newspaper n INNER JOIN country c ON(n.country_id = c.id) WHERE n.id=?1`
NewspaperByID returns a single newspaper filtering by newspaper.id
const NewspapersAll = `SELECT n.id, n.name, c.name, c.code FROM newspaper n INNER JOIN country c ON(n.country_id = c.id)`
NewspapersAll returns a list of newspapers for all the newspapers in the database
const NewspapersByCountry = `` /* 132-byte string literal not displayed */
NewspapersByCountry returns a list of newspapers filtering by country.code
const NewspapersByName = `` /* 139-byte string literal not displayed */
NewspapersByName returns a list of newspapers filtering by newspaper.name
const SectionsByName = `` /* 283-byte string literal not displayed */
SectionsByName is used for return a list of sections filtering by section.name
const SectionsByNewspaper = `` /* 213-byte string literal not displayed */
SectionsByNewspaper is used for return a list of sections by newspaper.id
const SectionsByTags = `` /* 149-byte string literal not displayed */
SectionsByTags const
const TagsIDs = `SELECT id FROM category WHERE UPPER(name) in (?1)`
TagsIDs returns the category ids for a list of tags
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FilterCollection ¶
type FilterCollection struct {
Filters []Filter `json:"filters"`
}
func GetFilters ¶
func GetFilters(db *sql.DB) FilterCollection
type News ¶
type Newspaper ¶
type Newspapers ¶
type Newspapers struct {
Newspapers []Newspaper `json:"items"`
}
func GetNewspapers ¶
func GetNewspapers(db *sql.DB) Newspapers
func GetNewspapersByCountry ¶
func GetNewspapersByCountry(db *sql.DB, countryCode string) Newspapers
func GetNewspapersByName ¶
func GetNewspapersByName(db *sql.DB, name string) Newspapers
type Section ¶
type Section struct { ID int `json:"id"` Name string `json:"name"` RSS string `json:"rss"` Failed bool `json:"failed"` Newspaper string `json:"newspaper"` Subscribed bool `json:"subscribed"` }
Section contains information related to the section table in the database
type Sections ¶
type Sections struct {
Sections []Section `json:"sections"`
}
Sections is a list of Section
func GetSectionsByName ¶
GetSectionsByName returns an instance of Sections filtered by section name
func GetSectionsByNewspaper ¶
GetSectionsByNewspaper returns an instance of Sections filtered by newspaperID