Documentation ¶
Overview ¶
Package subscription holds the data types for subscriptions and podcast episodes
Index ¶
- Variables
- func AllTypes() []interface{}
- type Episode
- type SubHandler
- func (s SubHandler) AddEpisodes(sub Subscription, eps []Episode) error
- func (s SubHandler) GetSubscriptionByTag(tag string) (Subscription, error)
- func (s SubHandler) GetSubscriptions() ([]Subscription, error)
- func (s SubHandler) GetSubscriptionsByTags(tags ...string) ([]Subscription, error)
- func (s SubHandler) NewSubscription(sub *Subscription) error
- func (s SubHandler) RemoveEpisodes(eps []Episode) error
- func (s SubHandler) RemoveSubscriptions(subs []Subscription) error
- func (s SubHandler) UpdateSubscription(sub Subscription) error
- type Subscription
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSubNotFound is the error returned for when searching subscriptions by tag returned no results ErrSubNotFound = errors.New("Subscription tag was not found") )
Functions ¶
Types ¶
type Episode ¶
type Episode struct { ID uint `gorm:"primarykey"` SubscriptionID int Title string URL string `gorm:"unique"` PublishedAt time.Time }
Episode contains the information about a single podcast episode
type SubHandler ¶
type SubHandler struct {
// contains filtered or unexported fields
}
SubHandler is a sub data handler, in charge of data access methods for the subscription data types
func Handler ¶
func Handler(db *gorm.DB) SubHandler
Handler creates a new subscription handler from the given gorm object
func (SubHandler) AddEpisodes ¶
func (s SubHandler) AddEpisodes(sub Subscription, eps []Episode) error
AddEpisodes adds the given episodes to the database
func (SubHandler) GetSubscriptionByTag ¶
func (s SubHandler) GetSubscriptionByTag(tag string) (Subscription, error)
GetSubscriptionByTag returns a subscription by its tag
func (SubHandler) GetSubscriptions ¶
func (s SubHandler) GetSubscriptions() ([]Subscription, error)
GetSubscriptions returns an array of every subscription
func (SubHandler) GetSubscriptionsByTags ¶
func (s SubHandler) GetSubscriptionsByTags(tags ...string) ([]Subscription, error)
GetSubscriptionsByTags returns all subscribtions with the given tags
func (SubHandler) NewSubscription ¶
func (s SubHandler) NewSubscription(sub *Subscription) error
NewSubscription adds the given subscription to the database as a new entry
func (SubHandler) RemoveEpisodes ¶
func (s SubHandler) RemoveEpisodes(eps []Episode) error
RemoveEpisodes removes the given episodes from the database
func (SubHandler) RemoveSubscriptions ¶
func (s SubHandler) RemoveSubscriptions(subs []Subscription) error
RemoveSubscriptions removes the given subscriptions from the database
func (SubHandler) UpdateSubscription ¶
func (s SubHandler) UpdateSubscription(sub Subscription) error
UpdateSubscription saves changes to this subscription to the database