model

package
v0.0.0-...-5316ec1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePage

func CreatePage(p PageDB) (err error)

CreatePage inserts a new page to the database

func CreatePost

func CreatePost(p PostDB) (err error)

CreatePost inserts a new post to the database

func DeletePost

func DeletePost(ID string) (err error)

UpdatePost update an article exists in the database

func UpdatePage

func UpdatePage(p PageDB) (err error)

UpdatePage update a page exists in the database

func UpdatePost

func UpdatePost(p PostDB) (err error)

UpdatePost update an article exists in the database

Types

type Page

type Page struct {
	ID      string
	Content string
	HTML    template.HTML
}

Page is a display struct for Page

func GetPageByID

func GetPageByID(id string) (p Page, err error)

GetPageByID return an article matching the id

func ListPages

func ListPages() (pages []Page, err error)

ListPages list all pages in the database

type PageDB

type PageDB struct {
	ID      string `firestore:"id,omitempty"`
	Content string `firestore:"content,omitempty"`
	HTML    string `firestore:"html,omitempty"`
}

PageDB is a database struct for Page

type Post

type Post struct {
	ID      string
	Title   string
	Content string
	HTML    template.HTML
	Slug    string
	Created string
}

func GetPostByID

func GetPostByID(id string) (at Post, err error)

GetPostByID return an article matching the id

func ListPosts

func ListPosts() (posts []Post, err error)

List all posts in the database

type PostDB

type PostDB struct {
	ID      string `firestore:"id,omitempty"`
	Title   string `firestore:"title,omitempty"`
	Content string `firestore:"content,omitempty"`
	HTML    string `firestore:"html,omitempty"`
	Slug    string `firestore:"slug,omitempty"`
	Created string `firestore:"created,omitempty"`
}

Article Struct

Jump to

Keyboard shortcuts

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