models

package
v0.0.0-...-e7b3743 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 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 Category

type Category struct {
	ID       int           `db:"id" json:"id"`
	Name     string        `db:"name" json:"name"`
	ParentID sql.NullInt64 `db:"parent_id" json:"parentId"`
}

Category is a single feed category e.g. "Arts"

type Channel

type Channel struct {
	ID          int            `db:"id" json:"id"`
	Title       string         `db:"title" json:"title"`
	Description string         `db:"description" json:"description"`
	Keywords    sql.NullString `db:"keywords" json:"-"`
	Image       string         `db:"image" json:"image"`
	URL         string         `db:"url" json:"url"`
	Website     sql.NullString `db:"website" json:"website"`
	NumPodcasts int            `db:"num_podcasts" json:"numPodcasts"`
	Podcasts    []*Podcast     `db:"-" json:"-"`
	Categories  []string       `db:"-" json:"-"`
}

Channel is a single RSS/Atom podcast feed

type ChannelDetail

type ChannelDetail struct {
	Channel    *Channel   `json:"channel"`
	Categories []Category `json:"categories"`
	Podcasts   []Podcast  `json:"podcasts"`
	Related    []Channel  `json:"relatedChannels"`
	Page       *Paginator `json:"page"`
}

ChannelDetail includes channel, podcast, and related channel info

type OPML

type OPML struct {
	XMLName  xml.Name   `xml:"opml"`
	Version  string     `xml:"version,attr"`
	Title    string     `xml:"head>title"`
	Outlines []*Outline `xml:"body>outline"`
}

OPML encapsulates an OPML XML document

type Outline

type Outline struct {
	XMLName xml.Name `xml:"outline"`
	Type    string   `xml:"type,attr"`
	Title   string   `xml:"title,attr"`
	Text    string   `xml:"text,attr"`
	URL     string   `xml:"xmlUrl,attr"`
	HTMLURL string   `xml:"htmlUrl,attr,omitempty"`
}

Outline is info on a single feed inside an OPML doc

type Paginator

type Paginator struct {
	NumRows     int `json:"numRows"`
	NumPages    int `json:"numPages"`
	CurrentPage int `json:"page"`
	PageSize    int `json:"pageSize"`
	Offset      int `json:"-"`
}

Paginator contains row/page/offset etc for a page instance

func NewPaginator

func NewPaginator(page int, numRows int) *Paginator

NewPaginator creates a new Paginator instance with precalculated fields

type Play

type Play struct {
	PodcastID int       `db:"podcast_id" json:"podcastId"`
	CreatedAt time.Time `db:"created_at" json:"createdAt"`
}

Play is a single timestamp/podcast play time

type Podcast

type Podcast struct {
	ID           int       `db:"id" json:"id"`
	ChannelID    int       `db:"channel_id" json:"channelId"`
	GUID         string    `db:"guid" json:"-"`
	Name         string    `db:"name" json:"name"`
	Image        string    `db:"image" json:"image"`
	Title        string    `db:"title" json:"title"`
	Source       string    `db:"source" json:"source"`
	Description  string    `db:"description" json:"description"`
	EnclosureURL string    `db:"enclosure_url" json:"enclosureUrl"`
	PubDate      time.Time `db:"pub_date" json:"pubDate"`
	CreatedAt    time.Time `db:"created_at" json:"-"`
}

Podcast is a single podcast item

type PodcastList

type PodcastList struct {
	Podcasts []Podcast  `json:"podcasts"`
	Page     *Paginator `json:"page"`
}

PodcastList is a paginated list of podcasts

func NewPodcastList

func NewPodcastList(page int) *PodcastList

NewPodcastList creates a new PodcastList instance

type SearchResult

type SearchResult struct {
	Channels []Channel    `json:"channels"`
	Podcasts *PodcastList `json:"podcasts"`
}

SearchResult includes all search data

func NewSearchResult

func NewSearchResult(page int) *SearchResult

NewSearchResult creates a properly initialized search result

type User

type User struct {
	ID            int       `db:"id" json:"id"`
	Name          string    `db:"name" json:"name"`
	Email         string    `db:"email" json:"email"`
	Password      string    `db:"password" json:"-"`
	CreatedAt     time.Time `db:"created_at" json:"-"`
	Bookmarks     []int     `db:"-" json:"bookmarks"`
	Subscriptions []int     `db:"-" json:"subscriptions"`
	Plays         []Play    `db:"-" json:"plays"`
}

User is the current authenticated user

func (*User) CheckPassword

func (user *User) CheckPassword(password string) bool

CheckPassword checks if the password matches the encrypted password

func (*User) SetPassword

func (user *User) SetPassword(password string) error

SetPassword sets the Password field with an encrypted password

Directories

Path Synopsis
Godeps
_workspace/src/golang.org/x/crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
_workspace/src/golang.org/x/crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.

Jump to

Keyboard shortcuts

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