blog

package
v0.0.0-...-01a26c0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package blog holds the domain entities for the blog

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("Blog not found")

ErrNotFound is used when a blog could not be found.

Functions

This section is empty.

Types

type Blog

type Blog struct {
	ID       int
	Name     string
	SiteURL  string
	FeedURL  string
	PolledAt time.Time
	Active   bool
	Posts    []post.Post
}

Blog type holds information about blogs

func NewBlog

func NewBlog(id int, name string, siteURL string, feedURL string) *Blog

NewBlog creates a new blog with no posts

func (*Blog) AddPost

func (b *Blog) AddPost(post *post.Post)

AddPost adds a new post to a blog

type Repository

type Repository interface {
	Store(blog *Blog) error
	Find(id int) (*Blog, error)
	Count() int
	FindAll(limit int, page int) []*Blog
	FindPopular(limit int) []*Blog
}

Repository provides access a blog store

type Service

type Service interface {
	StoreNewBlog(name string, siteURL string, feedURL string) (*Blog, error)
	FindBlog(id int) (*Blog, error)
	StoreNewPost(blogID int, post *post.Post) (*post.Post, error)
	BlogCount() int
	FindAllBlogs(page int) []*Blog
	FindPopularBlogs() []*Blog
}

Service provides access a blog service

Jump to

Keyboard shortcuts

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