func AddExtension(e Extension)
func Run() error
type Account struct {
}
Attachment represents an attachment. It may be a normal file or a shortcut to an external resource via oEmbed.
type Attachment struct {
ID int
Post int
File string
Size int64
Hash string
Width int
Height int
Thumb string
ThumbWidth int
ThumbHeight int
Uploaded time.Time
}
type Ban struct {
}
type Extension interface {
Description() string
}
ExtensionAttach defines the interface for extensions that handle attaching files when creating a post.
type ExtensionAttach interface {
Extension
// Attach handles an uploaded file.
Attach(file io.Reader, size int64, mime string) (*Attachment, error)
}
ExtensionDatabase defines the interface for extensions that handle storing and retrieving information within a database.
type ExtensionDatabase interface {
Extension
CreateAccount(account *Account) error
AccountByID(id int) (*Account, error)
AccountByName(name string) (*Account, error)
Accounts() ([]*Account, error)
UpdateAccount(account *Account) error
DeleteAccount(account *Account) error
CreateBan(Ban *Ban) error
BanByID(id int) (*Ban, error)
BanByName(name string) (*Ban, error)
Bans() ([]*Ban, error)
UpdateBan(Ban *Ban) error
DeleteBan(Ban *Ban) error
CreateKeyword(Keyword *Keyword) error
KeywordByID(id int) (*Keyword, error)
KeywordByName(name string) (*Keyword, error)
Keywords() ([]*Keyword, error)
UpdateKeyword(Keyword *Keyword) error
DeleteKeyword(Keyword *Keyword) error
CreateLog(Log *Log) error
LogByID(id int) (*Log, error)
LogByName(name string) (*Log, error)
Logs() ([]*Log, error)
UpdateLog(Log *Log) error
DeleteLog(Log *Log) error
CreatePost(Post *Post) error
PostByID(id int) (*Post, error)
PostByName(name string) (*Post, error)
Posts() ([]*Post, error)
UpdatePost(Post *Post) error
DeletePost(Post *Post) error
CreateReport(Report *Report) error
ReportByID(id int) (*Report, error)
ReportByName(name string) (*Report, error)
Reports() ([]*Report, error)
UpdateReport(Report *Report) error
DeleteReport(Report *Report) error
}
ExtensionPost defines the interface for extensions that handle creating a post.
type ExtensionPost interface {
Extension
// Post is called when a new post is created. Extensions may modify the
// post and apply formatting or other operations on it. All text is
// initially HTML-escaped.
Post(post *Post) error
}
type Keyword struct{}
type Log struct{}
type Post struct {
ID int
Thread int
Name string
Email string
Subject string
Message string
}
func (p *Post) ThreadID() int
type Report struct{}