blog

package
v0.0.0-...-54db4b9 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blog

type Blog struct {
	// contains filtered or unexported fields
}

func New

func New(posts PostContainer) *Blog

func (*Blog) DeletePost

func (b *Blog) DeletePost(id string) error

func (*Blog) GetAll

func (b *Blog) GetAll() ([]Post, error)

func (*Blog) NewPost

func (b *Blog) NewPost(post *Post) error

type Comment

type Comment struct {
	Author  string
	Content string
}

type Post

type Post struct {
	ID        string
	CreatedAt time.Time
	Heading   string
	Author    string
	Content   string
	Likes     int64
	Comments  []Comment
}

type PostContainer

type PostContainer interface {
	Init() error
	GetAll() ([]Post, error)
	Insert(*Post) error
	Delete(string) error
}

Jump to

Keyboard shortcuts

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