const LogPageSize = 25
func Connect(c *Config) (*pgxpool.Pool, error)
DB represents a database connection.
type DB struct {
Plugin string
// contains filtered or unexported fields
}
func Begin(pool *pgxpool.Pool, config *Config) *DB
func (db *DB) AccountByID(id int) *Account
func (db *DB) AccountBySessionKey(sessionKey string) *Account
func (db *DB) AccountByUsername(username string) *Account
func (db *DB) AddAccount(a *Account, password string)
func (db *DB) AddBan(b *Ban)
func (db *DB) AddBanner(b *Banner)
func (db *DB) AddBoard(b *Board)
func (db *DB) AddCAPTCHA(c *CAPTCHA)
func (db *DB) AddFileBan(fileHash string)
func (db *DB) AddKeyword(k *Keyword)
func (db *DB) AddLog(l *Log)
func (db *DB) AddNews(n *News)
func (db *DB) AddPage(p *Page)
func (db *DB) AddPost(p *Post)
func (db *DB) AddReport(r *Report)
func (db *DB) AddSubscription(s *Subscription)
func (db *DB) AllAccounts() []*Account
func (db *DB) AllBanners() []*Banner
func (db *DB) AllBans(rangeOnly bool) []*Ban
func (db *DB) AllBoards() []*Board
func (db *DB) AllKeywords() []*Keyword
func (db *DB) AllNews(onlyPublished bool) []*News
func (db *DB) AllPages() []*Page
func (db *DB) AllPostsInThread(postID int, moderated bool) []*Post
func (db *DB) AllReplies(threadID int, limit int, moderated bool) []*Post
func (db *DB) AllReports() []*Report
func (db *DB) AllThreads(board *Board, moderated bool) [][2]int
AllThreads returns all thread IDs and reply counts. When board is nil, only threads belonging to boards included in the overboard are returned.
func (db *DB) BanByID(id int) *Ban
func (db *DB) BanByIP(ip string) *Ban
func (db *DB) BannerByID(id int) *Banner
func (db *DB) BannerByName(name string) *Banner
func (db *DB) BoardByDir(dir string) *Board
func (db *DB) BoardByID(id int) *Board
func (db *DB) BumpThread(threadID int, timestamp int64)
func (db *DB) Commit()
func (db *DB) CommitWithErr() error
func (db *DB) DeleteBan(id int)
func (db *DB) DeleteBanner(id int)
func (db *DB) DeleteBoard(id int)
func (db *DB) DeleteCAPTCHA(ip string)
func (db *DB) DeleteExpiredBans() int
func (db *DB) DeleteExpiredSubscriptions() int
func (db *DB) DeleteKeyword(id int)
func (db *DB) DeleteNews(id int)
func (db *DB) DeletePage(id int)
func (db *DB) DeletePost(postID int)
func (db *DB) DeleteReports(p *Post)
func (db *DB) DeleteSubscription(s *Subscription)
func (db *DB) DeleteSubscriptionsByBoard(boardID int)
func (db *DB) DeleteSubscriptionsByPost(postID int)
func (db *DB) Exec(sql string, arguments ...any) (pgconn.CommandTag, error)
func (db *DB) ExpiredCAPTCHAs() []*CAPTCHA
func (db *DB) FileBanned(fileHash string) bool
func (db *DB) GetBool(key string) bool
func (db *DB) GetCAPTCHA(ip string) *CAPTCHA
func (db *DB) GetFloat(key string) float64
func (db *DB) GetInt(key string) int
func (db *DB) GetInt64(key string) int64
func (db *DB) GetMultiInt(key string) []int
func (db *DB) GetMultiString(key string) []string
func (db *DB) GetString(key string) string
func (db *DB) HaveConfig(key string) bool
func (db *DB) KeywordByID(id int) *Keyword
func (db *DB) KeywordByText(text string) *Keyword
func (db *DB) LastPostByIP(board *Board, ip string) *Post
func (db *DB) LiftFileBan(fileHash string)
func (db *DB) LockPost(postID int, lock bool)
func (db *DB) LogCount() int
func (db *DB) LoginAccount(username string, password string) *Account
func (db *DB) LogsByPage(page int) []*Log
func (db *DB) ModeratePost(postID int, moderated PostModerated)
func (db *DB) NewCAPTCHAImage() string
func (db *DB) NewsByID(id int) *News
func (db *DB) NumReports(p *Post) int
func (db *DB) PageByID(id int) *Page
func (db *DB) PageByPath(path string) *Page
func (db *DB) PendingPosts() []*Post
func (db *DB) PostByField(b *Board, field string, value any) *Post
func (db *DB) PostByID(postID int) *Post
func (db *DB) PostsByFileHash(hash string, filterBoard *Board) []*Post
func (db *DB) PostsByIP(hash string) []*Post
func (db *DB) QueryRow(sql string, arguments ...any) pgx.Row
func (db *DB) ReplyCount(threadID int) int
func (db *DB) RollBack()
func (db *DB) SaveBool(key string, value bool)
func (db *DB) SaveFloat(key string, value float64)
func (db *DB) SaveInt(key string, value int)
func (db *DB) SaveInt64(key string, value int64)
func (db *DB) SaveMultiInt(key string, values []int)
func (db *DB) SaveMultiString(key string, value []string)
func (db *DB) SaveString(key string, value string)
func (db *DB) SoftRollBack()
func (db *DB) StickyPost(postID int, sticky bool)
func (db *DB) SubscriptionByID(id int) *Subscription
func (db *DB) SubscriptionByIP(ip string) *Subscription
func (db *DB) SubscriptionsByEmail(email string) []*Subscription
func (db *DB) SubscriptionsByPost(p *Post, distinct bool, includeBoard bool) []*Subscription
func (db *DB) TrimThreads(board *Board) []*Post
func (db *DB) UniqueUserPosts(b *Board) int
func (db *DB) UpdateAccountLastActive(id int)
func (db *DB) UpdateAccountLocale(id int, locale string)
func (db *DB) UpdateAccountPassword(id int, password string)
func (db *DB) UpdateAccountRole(a *Account)
func (db *DB) UpdateAccountStyle(id int, style string)
func (db *DB) UpdateAccountUsername(a *Account)
func (db *DB) UpdateBan(b *Ban)
func (db *DB) UpdateBanner(b *Banner)
func (db *DB) UpdateBoard(b *Board)
func (db *DB) UpdateCAPTCHA(c *CAPTCHA)
func (db *DB) UpdateKeyword(k *Keyword)
func (db *DB) UpdateNews(n *News)
func (db *DB) UpdatePage(p *Page)
func (db *DB) UpdatePostBoard(postID int, boardID int)
func (db *DB) UpdatePostMessage(postID int, message string)
func (db *DB) UpdatePostNameblock(postID int, nameblock string)
func (db *DB) UpdateSubscription(s *Subscription)