forked from jheuel/pollrBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.go
31 lines (29 loc) · 1.14 KB
/
store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import tg "github.com/semog/go-bot-api/v4"
// Store is an interface for the persistent storage
// should allow easier swapping of databases
type Store interface {
Init(databaseFile string) error
Close()
AddMsgToPoll(pollID int, messageID int, chatID int64) error
AddInlineMsgToPoll(pollID int, inlineMessageID string) error
RemoveInlineMsg(inlineMessageID string) error
GetUser(userID int) (*tg.User, error)
GetPoll(pollID int) (*poll, error)
GetUserPoll(pollID int, userID int) (*poll, error)
GetPollsByUser(userID int) ([]*poll, error)
GetPollID(messageID int) (int, error)
GetPollNewer(pollID int, userID int) (*poll, error)
GetPollOlder(pollID int, userID int) (*poll, error)
GetAllPollMsg(pollID int) ([]pollident, error)
GetAllPollInlineMsg(pollID int) ([]pollident, error)
GetState(userID int) (state int, pollID int, err error)
SaveState(userID int, pollID int, state int) error
SaveUser(*tg.User) error
SavePoll(*poll) (int, error)
SaveOptions([]option) error
DeleteOptions([]option) error
SaveAnswer(*poll, answer) (unvoted bool, err error)
ResetPoll(userID int, pollID int) error
DeletePoll(userID int, pollID int) error
}