cms

package
v0.0.0-...-8a09f7e Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tmpl = template.Must(template.ParseGlob("templates/*"))

Tmpl is a reference to all of our templates

Functions

func CreatePage

func CreatePage(p *Page) (int, error)

CreatePage creates a new page in our DB

func CreatePost

func CreatePost(p *Post) (int, error)

CreatePost creates a new post in our DB

func HandleNew

func HandleNew(w http.ResponseWriter, r *http.Request)

HandleNew hadnles preview logic

func ServeIndex

func ServeIndex(w http.ResponseWriter, r *http.Request)

ServeIndex serves the index page.

func ServePage

func ServePage(w http.ResponseWriter, r *http.Request)

ServePage serves a page based on the route matched. This will match any URL beginning with /page

func ServePost

func ServePost(w http.ResponseWriter, r *http.Request)

ServePost serves a post

Types

type Comment

type Comment struct {
	ID            int
	PostID        int
	Author        string
	Comment       string
	DatePublished time.Time
}

Comment is the struct used for each comment

type Page

type Page struct {
	ID      int
	Title   string
	Content string
	Posts   []*Post
}

Page is the struct used for each webpage

func GetPage

func GetPage(id string) (*Page, error)

GetPage gets the page by it's ID.

func GetPages

func GetPages() ([]*Page, error)

GetPages returns every page from our DB.

type PgStore

type PgStore struct {
	DB *sql.DB
}

PgStore is a reference to the password store.

type Post

type Post struct {
	ID            int
	Title         string
	Content       string
	DatePublished time.Time
	Comments      []*Comment
}

Post is the struct used for each blog post

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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