model

package
v0.0.0-...-5c1de5d Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ModelVersion = 1
View Source
const (
	Version = "version"
)

Variables

This section is empty.

Functions

func CheckExec

func CheckExec(q string, args ...interface{})

func CreatePost

func CreatePost(p PostW) (int64, error)

func CreateThread

func CreateThread(t ThreadW) (int64, error)

func Init

func Init()

func Migrate

func Migrate()

func PrepareQueries

func PrepareQueries()

func ReadConfig

func ReadConfig(key string) string

func WriteConfig

func WriteConfig(key, val string)

Types

type Board

type Board struct {
	Id   int64
	Code string
	Name string
}

func GetAllBoards

func GetAllBoards() ([]Board, error)

func GetBoardByCode

func GetBoardByCode(code string) (Board, error)

func GetBoardById

func GetBoardById(id int64) (Board, error)

func (*Board) GetAllPosts

func (b *Board) GetAllPosts() ([]Post, error)

type NullInt

type NullInt null.Int

sql.NullInt64 doesn't work here as we would expect

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool
}

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

type Post

type Post struct {
	Id             int64
	Content        string
	ThreadParentId NullInt
	BoardParentId  int64
	PostedAt       time.Time
	UpdatedAt      time.Time
	ArchivedAt     NullTime
}

func GetPostById

func GetPostById(id int64) (Post, error)

func (*Post) GetParentThread

func (p *Post) GetParentThread() ([]Post, error)

func (*Post) GetParentThreadCount

func (p *Post) GetParentThreadCount() (int64, error)

type PostW

type PostW struct {
	ThreadParentId int64
	Content        string
}

type ThreadW

type ThreadW struct {
	BoardParentId int64
	Content       string
}

Jump to

Keyboard shortcuts

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