models

package
v0.0.0-...-439c28b Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2013 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbSession

func GetDbSession() *gorp.DbMap

func GetThread

func GetThread(parent_id, page_id int) (error, *Post, []*Post)

Types

type Board

type Board struct {
	Id          int64  `db:"id"`
	Title       string `db:"title"`
	Description string `db:"description"`
}

func GetBoard

func GetBoard(id int) (error, *Board)

func (*Board) GetLatestPost

func (board *Board) GetLatestPost() BoardLatest

type BoardLatest

type BoardLatest struct {
	Op     *Post
	Latest *Post
}

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"`
}

func NewPost

func NewPost(author *User, board *Board, title, content string) *Post

func (*Post) GetLatestPost

func (post *Post) GetLatestPost() *Post

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) GetPagesInThread

func (post *Post) GetPagesInThread() int

func (*Post) PostGet

func (post *Post) PostGet(s gorp.SqlExecutor) error

type User

type User struct {
	Id       int64  `db:"id"`
	GroupId  int64  `db:"group_id"`
	Created  int64  `db:"created"`
	Username string `db:"username"`
	Password string `db:"password"`
	Avatar   string `db:"avatar"`
	Salt     string `db:"salt"`
}

func AuthenticateUser

func AuthenticateUser(username, password string) (error, *User)

func NewUser

func NewUser(username, password string) *User

func (*User) IsAdmin

func (user *User) IsAdmin() bool

Jump to

Keyboard shortcuts

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