Documentation ¶
Index ¶
- func GetDbSession() *gorp.DbMap
- func GetPostCount() (int64, error)
- func GetStringSetting(key string) (value string, err error)
- func GetThread(parent_id, page_id int) (error, *Post, []*Post)
- func GetUserCount() (int64, error)
- func SetStringSetting(key, value string) (err error)
- type Board
- type BoardLatest
- type JoinBoardView
- type JoinThreadView
- type Post
- func (post *Post) DeleteAllChildren() error
- func (post *Post) GetLatestPost() *Post
- func (post *Post) GetLink() string
- func (post *Post) GetPageInThread() int
- func (post *Post) GetPagesInThread() int
- func (post *Post) GetThreadId() int64
- func (post *Post) PostGet(s gorp.SqlExecutor) error
- func (post *Post) Validate() error
- type Setting
- type User
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDbSession ¶
func GetPostCount ¶
Returns the number of posts (on every board/thread)
func GetStringSetting ¶
func GetThread ¶
Returns a pointer to the OP and a slice of post pointers for the given page number in the thread.
func GetUserCount ¶
func SetStringSetting ¶
Types ¶
type Board ¶
type Board struct { Id int64 `db:"id"` Title string `db:"title"` Description string `db:"description"` Order int `db:"ordering"` }
func (*Board) Delete ¶
func (board *Board) Delete()
Deletes a board and all of the posts it contains
func (*Board) GetLatestPost ¶
func (board *Board) GetLatestPost() BoardLatest
func (*Board) GetPagesInBoard ¶
func (*Board) GetThreads ¶
func (board *Board) GetThreads(page int, user *User) ([]*JoinThreadView, error)
type BoardLatest ¶
type JoinBoardView ¶
type JoinBoardView struct { Board *Board `db:"-"` Id int64 `db:"id"` Title string `db:"title"` Description string `db:"description"` Order int `db:"ordering"` ViewedOn pq.NullTime `db:"viewed_on"` }
func GetBoardsUnread ¶
func GetBoardsUnread(user *User) ([]*JoinBoardView, error)
type JoinThreadView ¶
type JoinThreadView struct { Thread *Post `db:"-"` Id int64 `db:"id"` BoardId int64 `db:"board_id"` Author *User `db:"-"` AuthorId int64 `db:"author_id"` Title string `db:"title"` CreatedOn time.Time `db:"created_on"` LatestReply time.Time `db:"latest_reply"` Sticky bool `db:"sticky"` Locked bool `db:"locked"` ViewedOn pq.NullTime `db:"viewed_on"` }
type Post ¶
type Post struct { Id int64 `db:"id"` BoardId int64 `db:"board_id"` ParentId sql.NullInt64 `db:"parent_id"` Author *User `db:"-"` AuthorId int64 `db:"author_id"` Title string `db:"title"` Content string `db:"content"` CreatedOn time.Time `db:"created_on"` LatestReply time.Time `db:"latest_reply"` LastEdit time.Time `db:"last_edit"` Sticky bool `db:"sticky"` Locked bool `db:"locked"` }
func (*Post) DeleteAllChildren ¶
Used when deleting a thread. This deletes all posts who are children of the OP.
func (*Post) GetLatestPost ¶
This is used primarily for threads. It will find the latest post in a thread, allowing for things like "last post was 10 minutes ago.
func (*Post) GetPageInThread ¶
This function tells us which page this particular post is in within a thread based on the current value of posts_per_page
func (*Post) GetPagesInThread ¶
Returns the number of pages contained by a thread. This won't work on post structs that have ParentIds.
type User ¶
type User struct { Id int64 `db:"id"` GroupId int64 `db:"group_id"` CreatedOn time.Time `db:"created_on"` Username string `db:"username"` Password string `db:"password"` Avatar string `db:"avatar"` Signature sql.NullString `db:"signature"` Salt string `db:"salt"` StylesheetUrl sql.NullString `db:"stylesheet_url"` UserTitle string `db:"user_title"` LastSeen time.Time `db:"last_seen"` HideOnline bool `db:"hide_online"` LastUnreadAll pq.NullTime `db:"last_unread_all"` }
func AuthenticateUser ¶
func GetLatestUser ¶
func GetOnlineUsers ¶
func GetOnlineUsers() (users []*User)
func (*User) CanModerate ¶
func (*User) GetPostCount ¶
func (*User) SetPassword ¶
Converts the given string into an appropriate hash, resets the salt, and sets the Password attribute. Does *not* commit to the database.