krautreporter

package module
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2017 License: GPL-2.0 Imports: 1 Imported by: 0

README

Krautreporter API

Getting started

Clone this repository to your $GOPATH.

make

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID        int
	Ordering  int
	Title     string
	Headline  string
	Date      time.Time
	Preview   bool
	URL       string
	Excerpt   string
	Content   string
	CreatedAt time.Time
	UpdatedAt time.Time

	AuthorID int
	Author   *Author
	Images   []Image `gorm:"polymorphic:Imageable;"`
	Crawl    Crawl   `gorm:"polymorphic:Crawlable;"`
}

Article posted on krautreporter.de

func (*Article) AddImage

func (a *Article) AddImage(i Image)

AddImage adds an image to the article and makes sure that there's only one image for each width

type Author

type Author struct {
	ID          int
	Ordering    int
	Name        string
	Title       string
	URL         string
	Biography   string
	SocialMedia string
	CreatedAt   time.Time
	UpdatedAt   time.Time

	Images []Image `gorm:"polymorphic:Imageable;"`
	Crawl  Crawl   `gorm:"polymorphic:Crawlable;"`
}

Author posted on krautreporter.de

func (*Author) AddImage

func (a *Author) AddImage(i Image)

AddImage adds an image to the author and makes sure that there's only one image for each width

type Crawl

type Crawl struct {
	ID   int       `json:"id"`
	Next time.Time `json:"next"`

	CrawlableID   int    `json:"-"`
	CrawlableType string `json:"-"`
}

Crawl is a polymorphic relationship to entities which are being crawled in the future

type Image

type Image struct {
	ID    int
	Width int
	Src   string

	ImageableID   int
	ImageableType string
}

Image is polymorphic and can be used by Article or Author

Directories

Path Synopsis
cmd
api

Jump to

Keyboard shortcuts

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