...

Package model

Overview ▾

Package model provides models for sriracha data.

Index ▾

Constants
func FormatBoardApproval(a BoardApproval) string
func FormatBoardHide(a BoardHide) string
func FormatBoardIdentifiers(i BoardIdentifiers) string
func FormatBoardLock(l BoardLock) string
func FormatBoardType(t BoardType) string
func FormatRefLink(boardPath string, threadID int, postID int) []byte
func FormatRole(role AccountRole) string
func Get(board *Board, account *Account, str string, vars ...interface{}) string
type Account
    func (a *Account) LastActiveDate() string
    func (a *Account) Validate() error
type AccountRole
type Ban
    func (b *Ban) ExpireDate() string
    func (b *Ban) Info() string
    func (b *Ban) TypeLabel() string
    func (b *Ban) Validate() error
type Board
    func NewBoard() *Board
    func (b *Board) HasEmbed(name string) bool
    func (b *Board) HasUpload(mimeType string) bool
    func (b *Board) MaxSizeLabel(thread bool) string
    func (b *Board) Path() string
    func (b *Board) UploadTypesLabel(uploadTypes []*UploadType) string
    func (b *Board) Validate() error
type BoardApproval
type BoardHide
type BoardIdentifiers
type BoardLock
type BoardType
type CAPTCHA
type Keyword
    func (k *Keyword) ActionLabel(account *Account) string
    func (k *Keyword) HasBoard(id int) bool
    func (k *Keyword) Validate() error
type Log
    func (l *Log) InfoLabel() template.HTML
    func (l *Log) MessageLabel() template.HTML
    func (l *Log) TimestampDate() string
type News
    func (n *News) DateInput() string
    func (n *News) DateLabel() template.HTML
    func (n *News) MayDelete(a *Account) bool
    func (n *News) MayUpdate(a *Account) bool
    func (n *News) Validate() error
type Post
    func (p *Post) AddMediaOverlay(img image.Image) image.Image
    func (p *Post) Backlinks(posts []*Post) template.HTML
    func (p *Post) Copy() *Post
    func (p *Post) EmbedInfo() []string
    func (p *Post) ExpandHTML() template.HTML
    func (p *Post) FileSizeLabel() string
    func (p *Post) Identifier(identifiers bool, force bool) string
    func (p *Post) IsEmbed() bool
    func (p *Post) IsOekaki() bool
    func (p *Post) IsSWF() bool
    func (p *Post) MessageTruncated(lines int, account *Account) template.HTML
    func (p *Post) RefLink() template.HTML
    func (p *Post) SetNameBlock(defaultName string, capcode string, identifiers bool)
    func (p *Post) Thread() int
    func (p *Post) TimestampLabel() template.HTML
    func (p *Post) URL(siteHome string) string
type PostModerated
type Report

Package files

model.go model_account.go model_ban.go model_board.go model_captcha.go model_keyword.go model_log.go model_news.go model_post.go model_report.go

Constants

const (
    DefaultBoardThreads     = 10
    DefaultBoardReplies     = 3
    DefaultBoardMaxName     = 75
    DefaultBoardMaxEmail    = 75
    DefaultBoardMaxSubject  = 75
    DefaultBoardMaxMessage  = 8000
    DefaultBoardWordBreak   = 200
    DefaultBoardDefaultName = "Anonymous"
    DefaultBoardTruncate    = 15
    DefaultBoardMaxSize     = 2097152
    DefaultBoardThumbWidth  = 250
    DefaultBoardThumbHeight = 250
    DefaultBoardInstances   = 1
)

func FormatBoardApproval

func FormatBoardApproval(a BoardApproval) string

func FormatBoardHide

func FormatBoardHide(a BoardHide) string

func FormatBoardIdentifiers

func FormatBoardIdentifiers(i BoardIdentifiers) string

func FormatBoardLock

func FormatBoardLock(l BoardLock) string

func FormatBoardType

func FormatBoardType(t BoardType) string
func FormatRefLink(boardPath string, threadID int, postID int) []byte

func FormatRole

func FormatRole(role AccountRole) string

func Get

func Get(board *Board, account *Account, str string, vars ...interface{}) string

type Account

type Account struct {
    ID         int
    Username   string
    Password   string
    Role       AccountRole
    LastActive int64
    Session    string
    Style      string
    Locale     string
}

func (*Account) LastActiveDate

func (a *Account) LastActiveDate() string

func (*Account) Validate

func (a *Account) Validate() error

type AccountRole

type AccountRole int

Account roles.

const (
    RoleSuperAdmin AccountRole = 1
    RoleAdmin      AccountRole = 2
    RoleMod        AccountRole = 3
    RoleDisabled   AccountRole = 99
)

type Ban

type Ban struct {
    ID        int
    IP        string
    Timestamp int64
    Expire    int64
    Reason    string
}

func (*Ban) ExpireDate

func (b *Ban) ExpireDate() string

func (*Ban) Info

func (b *Ban) Info() string

func (*Ban) TypeLabel

func (b *Ban) TypeLabel() string

func (*Ban) Validate

func (b *Ban) Validate() error

type Board

type Board struct {
    ID            int
    Dir           string
    Name          string
    Description   string
    Type          BoardType
    Hide          BoardHide
    Lock          BoardLock
    Approval      BoardApproval
    Reports       bool
    Style         string
    Locale        string
    Delay         int
    MinName       int
    MaxName       int
    MinEmail      int
    MaxEmail      int
    MinSubject    int
    MaxSubject    int
    MinMessage    int
    MaxMessage    int
    MinSizeThread int64
    MaxSizeThread int64
    MinSizeReply  int64
    MaxSizeReply  int64
    ThumbWidth    int
    ThumbHeight   int
    DefaultName   string
    WordBreak     int
    Truncate      int
    Threads       int
    Replies       int
    MaxThreads    int
    MaxReplies    int
    Oekaki        bool
    Backlinks     bool
    Instances     int
    Identifiers   BoardIdentifiers

    // Calculated fields.
    Uploads []string
    Embeds  []string
    Rules   []string
    Unique  int `diff:"-"`
}

func NewBoard

func NewBoard() *Board

func (*Board) HasEmbed

func (b *Board) HasEmbed(name string) bool

func (*Board) HasUpload

func (b *Board) HasUpload(mimeType string) bool

func (*Board) MaxSizeLabel

func (b *Board) MaxSizeLabel(thread bool) string

func (*Board) Path

func (b *Board) Path() string

func (*Board) UploadTypesLabel

func (b *Board) UploadTypesLabel(uploadTypes []*UploadType) string

func (*Board) Validate

func (b *Board) Validate() error

type BoardApproval

type BoardApproval int
const (
    ApprovalNone BoardApproval = 0
    ApprovalFile BoardApproval = 1
    ApprovalAll  BoardApproval = 2
)

type BoardHide

type BoardHide int
const (
    HideNowhere    BoardHide = 0
    HideIndex      BoardHide = 1
    HideOverboard  BoardHide = 2
    HideEverywhere BoardHide = 3
)

type BoardIdentifiers

type BoardIdentifiers int
const (
    IdentifiersDisable BoardIdentifiers = 0
    IdentifiersBoard   BoardIdentifiers = 1
    IdentifiersGlobal  BoardIdentifiers = 2
)

type BoardLock

type BoardLock int

Board lock types.

const (
    LockNone   BoardLock = 0
    LockThread BoardLock = 1
    LockPost   BoardLock = 2
    LockStaff  BoardLock = 3
)

type BoardType

type BoardType int

Board types.

const (
    TypeImageboard BoardType = 0
    TypeForum      BoardType = 1
)

type CAPTCHA

type CAPTCHA struct {
    IP        string
    Timestamp int64
    Refresh   int
    Image     string
    Text      string
}

type Keyword

type Keyword struct {
    ID     int
    Text   string
    Action string
    Boards []*Board `diff:"-"`
}

func (*Keyword) ActionLabel

func (k *Keyword) ActionLabel(account *Account) string

func (*Keyword) HasBoard

func (k *Keyword) HasBoard(id int) bool

func (*Keyword) Validate

func (k *Keyword) Validate() error

type Log

type Log struct {
    ID        int
    Account   *Account
    Board     *Board
    Timestamp int64
    Message   string
    Changes   string
}

func (*Log) InfoLabel

func (l *Log) InfoLabel() template.HTML

func (*Log) MessageLabel

func (l *Log) MessageLabel() template.HTML

func (*Log) TimestampDate

func (l *Log) TimestampDate() string

type News

type News struct {
    ID        int
    Account   *Account
    Timestamp int64
    Modified  int64
    Share     bool
    Name      string
    Subject   string
    Message   string
}

func (*News) DateInput

func (n *News) DateInput() string

func (*News) DateLabel

func (n *News) DateLabel() template.HTML

func (*News) MayDelete

func (n *News) MayDelete(a *Account) bool

func (*News) MayUpdate

func (n *News) MayUpdate(a *Account) bool

func (*News) Validate

func (n *News) Validate() error

type Post

type Post struct {
    ID           int
    Board        *Board
    Parent       int
    Timestamp    int64
    Bumped       int64
    IP           string
    Name         string
    Tripcode     string
    Email        string
    NameBlock    string
    Subject      string
    Message      string
    Password     string
    File         string
    FileMIME     string
    FileHash     string
    FileOriginal string
    FileSize     int64
    FileWidth    int
    FileHeight   int
    Thumb        string
    ThumbWidth   int
    ThumbHeight  int
    Moderated    PostModerated
    Stickied     bool
    Locked       bool

    // Calculated fields.
    Replies int
}

func (*Post) AddMediaOverlay

func (p *Post) AddMediaOverlay(img image.Image) image.Image
func (p *Post) Backlinks(posts []*Post) template.HTML

func (*Post) Copy

func (p *Post) Copy() *Post

func (*Post) EmbedInfo

func (p *Post) EmbedInfo() []string

func (*Post) ExpandHTML

func (p *Post) ExpandHTML() template.HTML

func (*Post) FileSizeLabel

func (p *Post) FileSizeLabel() string

func (*Post) Identifier

func (p *Post) Identifier(identifiers bool, force bool) string

func (*Post) IsEmbed

func (p *Post) IsEmbed() bool

func (*Post) IsOekaki

func (p *Post) IsOekaki() bool

func (*Post) IsSWF

func (p *Post) IsSWF() bool

func (*Post) MessageTruncated

func (p *Post) MessageTruncated(lines int, account *Account) template.HTML
func (p *Post) RefLink() template.HTML

func (*Post) SetNameBlock

func (p *Post) SetNameBlock(defaultName string, capcode string, identifiers bool)

func (*Post) Thread

func (p *Post) Thread() int

func (*Post) TimestampLabel

func (p *Post) TimestampLabel() template.HTML

func (*Post) URL

func (p *Post) URL(siteHome string) string

type PostModerated

type PostModerated int
const (
    ModeratedHidden   PostModerated = 0
    ModeratedVisible  PostModerated = 1
    ModeratedApproved PostModerated = 2
)

type Report

type Report struct {
    ID        int
    Board     *Board
    Post      *Post
    Timestamp int64
    IP        string

    // Calculated fields.
    Count int
}