...

Package sriracha

Overview ▾

func AddExtension

func AddExtension(e Extension)

func Run

func Run() error

type Account

type Account struct {
}

type Attachment

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

type Ban struct {
}

type Extension

type Extension interface {
    Description() string
}

type ExtensionAttach

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

type ExtensionDatabase

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
}

type ExtensionPost

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

type Keyword struct{}

type Log

type Log struct{}

type Post

type Post struct {
    ID      int
    Thread  int
    Name    string
    Email   string
    Subject string
    Message string
}

func (*Post) ThreadID

func (p *Post) ThreadID() int

type Report

type Report struct{}

Subdirectories

Name Synopsis
..
asset
cmd
sriracha
extension