...
1
2 package sriracha
3
4 import . "codeberg.org/tslocum/sriracha/model"
5
6
7
8 type DB interface {
9
10 HaveConfig(key string) bool
11 GetString(key string) string
12 SaveString(key string, value string)
13 GetMultiString(key string) []string
14 SaveMultiString(key string, value []string)
15 GetBool(key string) bool
16 SaveBool(key string, value bool)
17 GetInt(key string) int
18 SaveInt(key string, value int)
19 GetMultiInt(key string) []int
20 SaveMultiInt(key string, values []int)
21 GetInt64(key string) int64
22 SaveInt64(key string, value int64)
23 GetFloat(key string) float64
24 SaveFloat(key string, value float64)
25
26
27 AddAccount(a *Account, password string)
28 AccountByID(id int) *Account
29 AccountByUsername(username string) *Account
30 AccountBySessionKey(sessionKey string) *Account
31 AllAccounts() []*Account
32 UpdateAccountUsername(a *Account)
33 UpdateAccountRole(a *Account)
34 UpdateAccountPassword(id int, password string)
35 UpdateAccountLastActive(id int)
36 UpdateAccountStyle(id int, style string)
37 UpdateAccountLocale(id int, locale string)
38 LoginAccount(username string, password string) *Account
39
40
41 AddBan(b *Ban)
42 BanByID(id int) *Ban
43 BanByIP(ip string) *Ban
44 AllBans(rangeOnly bool) []*Ban
45 UpdateBan(b *Ban)
46 DeleteExpiredBans() int
47 DeleteBan(id int)
48
49
50 AddFileBan(fileHash string)
51 FileBanned(fileHash string) bool
52 LiftFileBan(fileHash string)
53
54
55 AddBoard(b *Board)
56 BoardByID(id int) *Board
57 BoardByDir(dir string) *Board
58 UniqueUserPosts(b *Board) int
59 AllBoards() []*Board
60 DeleteBoard(id int)
61 UpdateBoard(b *Board)
62
63
64 AddCAPTCHA(c *CAPTCHA)
65 GetCAPTCHA(ip string) *CAPTCHA
66 UpdateCAPTCHA(c *CAPTCHA)
67 ExpiredCAPTCHAs() []*CAPTCHA
68 DeleteCAPTCHA(ip string)
69 NewCAPTCHAImage() string
70
71
72 AddKeyword(k *Keyword)
73 KeywordByID(id int) *Keyword
74 KeywordByText(text string) *Keyword
75 AllKeywords() []*Keyword
76 UpdateKeyword(k *Keyword)
77 DeleteKeyword(id int)
78
79
80 AddLog(l *Log)
81 LogCount() int
82 LogsByPage(page int) []*Log
83
84
85 AddNews(n *News)
86 NewsByID(id int) *News
87 AllNews(onlyPublished bool) []*News
88 UpdateNews(n *News)
89 DeleteNews(id int)
90
91
92 AddPost(p *Post)
93 AllThreads(board *Board, moderated bool) [][2]int
94 TrimThreads(board *Board) []*Post
95 AllPostsInThread(postID int, moderated bool) []*Post
96 AllReplies(threadID int, limit int, moderated bool) []*Post
97 PendingPosts() []*Post
98 PostByID(postID int) *Post
99 PostsByIP(hash string) []*Post
100 PostsByFileHash(hash string, filterBoard *Board) []*Post
101 PostByField(b *Board, field string, value any) *Post
102 LastPostByIP(board *Board, ip string) *Post
103 ReplyCount(threadID int) int
104 BumpThread(threadID int, timestamp int64)
105 ModeratePost(postID int, moderated PostModerated)
106 StickyPost(postID int, sticky bool)
107 LockPost(postID int, lock bool)
108 UpdatePostNameblock(postID int, nameblock string)
109 UpdatePostMessage(postID int, message string)
110 DeletePost(postID int)
111
112
113 AddReport(r *Report)
114 AllReports() []*Report
115 NumReports(p *Post) int
116 DeleteReports(p *Post)
117 }
118
View as plain text