models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB()

func DeleteCommentID

func DeleteCommentID(id int) error

func DeletePost

func DeletePost(post int) error

func DeleteUser

func DeleteUser(user int) error

func InitDB

func InitDB(dbfile, initfile string) error

func QueryNextPost

func QueryNextPost(post int) (int, error)

func QueryPrevPost

func QueryPrevPost(post int) (int, error)

func QueryUserExists

func QueryUserExists(name string) (bool, error)

func UpdatePost

func UpdatePost(p SQLPost) error

func UpdateUser

func UpdateUser(user SQLUser) error

func WriteComment

func WriteComment(c SQLComment) error

func WriteCommentReply

func WriteCommentReply(c SQLComment) error

func WritePost

func WritePost(p SQLPost) error

func WriteUser

func WriteUser(user SQLUser) error

Types

type SQLComment

type SQLComment struct {
	Commentid int64
	Postid    int
	Parentid  sql.NullInt64
	Userid    int
	Body      string
	Posted    int64
	Updated   int64
	// Not in SQL below this comment
	Separator string
	Indent    int
	Username  string
	Nicetime  string
}

func QueryCommentID

func QueryCommentID(id int) (SQLComment, error)

func QueryCommentsPost

func QueryCommentsPost(post int) ([]SQLComment, error)

type SQLPost

type SQLPost struct {
	Postid     int
	Userid     int
	Title      string
	Body       string
	BodyHTML   string
	RenderHTML template.HTML
	Categoryid int
	Posted     int64
	Updated    int64
	// Not in SQL below this line
	Username    string
	PostedNice  string
	UpdatedNice string
}

func ProcessPosts

func ProcessPosts(posts []SQLPost) ([]SQLPost, error)

ProcessPosts adds the following dynamic information to a slice of SQLPost objects: the username that posted them and the 'nice time' of their post and last updated date.

func QueryPost

func QueryPost(post int) (SQLPost, error)

func QueryPostsPage

func QueryPostsPage(page, size int) ([]SQLPost, error)

QueryPostsPage returns posts in page page, of size size.

func QueryPostsUserID

func QueryPostsUserID(user int) ([]SQLPost, error)

type SQLUser

type SQLUser struct {
	Userid      int
	Name        string
	Salt        string
	Token       string
	AccessLevel int
}

func QueryUser

func QueryUser(name, token string) (SQLUser, error)

func QueryUserID

func QueryUserID(user int) (SQLUser, error)

func QueryUsername

func QueryUsername(name string) (SQLUser, error)

func QueryUsersAll

func QueryUsersAll() ([]SQLUser, error)

type Siteconf

type Siteconf struct {
	SiteTitle string
	Title     string
	Copyright string
	Email     string
	Prev      int
	Next      int
}
var Site Siteconf

Jump to

Keyboard shortcuts

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