models

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) *gorm.DB

Types

type BaseModel

type BaseModel struct {
	ID        uint64    `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Episode

type Episode struct {
	BaseModel
	PodcastRef  uint       `json:"podcast_ref"`
	GUID        string     `json:"guid"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	URL         string     `json:"url"`
	Duration    string     `json:"duration"`
	Type        string     `json:"type"`
	ImageURL    string     `json:"image_url"`
	ImageTitle  string     `json:"image_title"`
	Published   *time.Time `json:"published"`
}

func NewEpisodeFromItem

func NewEpisodeFromItem(item *gofeed.Item) *Episode

type Podcast

type Podcast struct {
	BaseModel

	Author      string  `json:"author" gorm:""`
	Description string  `json:"description"`
	FeedURL     *string `json:"feed_url" gorm:"not null;unique"`
	ImageTitle  string  `json:"image_title" gorm:""`
	ImageURL    string  `json:"image_url" gorm:""`
	Link        string  `json:"link"`
	Title       string  `json:"title" gorm:"not_null"`

	ImageResized200 []byte `json:"-"`

	Episodes []*Episode `json:"episodes" gorm:"ForeignKey:PodcastRef"`
}

func (*Podcast) Crawl

func (p *Podcast) Crawl() error

func (*Podcast) PopulateFromFeed

func (p *Podcast) PopulateFromFeed(feed *gofeed.Feed) error

type User

type User struct {
	BaseModel
	Email    string `json:"email" gorm:"not_null;unique_index"`
	Name     string `json:"name" gorm:"not_null"`
	Password string `json:"password,omitempty" gorm:"not null"`
}

Jump to

Keyboard shortcuts

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