forum

package
v0.0.0-...-1bc63cf Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnswerPost

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

AnswerPost parses and inserts the data for a new forum topic answer.

func Forum

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

Forum endpoint returns the forum index.

func InsertNewAnswer

func InsertNewAnswer(db *sql.DB, username, text, topic string) error

InsertNewAnswer inserts a new forum post as an answer to the forum topic associated with the topic by the topic slug into the database.

func InsertNewTopic

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

InsertNewTopic endpoint parses the form data and inserts a new forum topic with an associated post.

func InsertNewTopicInDB

func InsertNewTopicInDB(db *sql.DB, username, title, text string) (string, error)

InsertNewTopicInDB inserts a new forum topic and the associated forum post into the database.

func NewForumTopic

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

NewForumTopic returns the HTML page we use to create a forum topic.

func PostPage

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

PostPage endpoint returns a forum topic with all of its posts.

Types

type FPost

type FPost struct {
	Title string
	Text  string
	Slug  string
}

FPost contains the data for a single Forum post.

func GetForumPosts

func GetForumPosts(db *sql.DB, slug string) ([]FPost, error)

GetForumPosts returns forum topics with all forum posts by the forum topic slug from the database.

func GetForumTopicsAndPost

func GetForumTopicsAndPost(db *sql.DB) ([]FPost, error)

GetForumTopicsAndPost returns forums topics with their initial forum post.

type Page

type Page struct {
	Title string
	Paths []helpers.Path
}

Page is a generic struct for a general HTML page. Only contains the necessary data to render the page.

type Post

type Post struct {
	Title  string
	Paths  []helpers.Path
	Topics []FPost
	Posts  []FPost
}

Post contains the data to render the HTML page for a single post.

type PostPageData

type PostPageData struct {
	Title string
	Paths []helpers.Path
	Posts []FPost
}

PostPageData contains the data to render the HTML page for the forum index.

Jump to

Keyboard shortcuts

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