Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCannotSaveNonIteration = errors.New("cannot save non-iteration item") ErrNoTGUser = errors.New("no such telegram user") )
View Source
var (
ErrNoFAUser = errors.New("no such furaffinity user")
)
View Source
var (
ErrNoSearch = errors.New("no such search")
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { Close() error AddSearchForUser(userID TelegramID, search string) error DeleteSearchForUser(userID TelegramID, search string) error IterateSearches(cb SearchIterator) error AddUserSubmissionsForUser(userID TelegramID, faUser string) error DeleteUserSubmissionsForUser(userID TelegramID, faUser string) error AddUserJournalsForUser(userID TelegramID, faUser string) error DeleteUserJournalsForUser(userID TelegramID, faUser string) error IterateUsers(cb UserIterator) error GetTGUser(id TelegramID) (*TGUser, error) SaveTGUser(user *TGUser) error }
DB is an interface that can load and store information in a database.
type FAUser ¶
type FAUser struct { // TODO have a way to get and store the preferred case of the username Username string `json:"username"` LastRun time.Time `json:"last_run"` LastSubmissionID int64 `json:"last_submission_id"` LastJournalID int64 `json:"last_journal_id"` SubmissionUsers map[TelegramID]bool `json:"submission_users"` JournalUsers map[TelegramID]bool `json:"journal_users"` // contains filtered or unexported fields }
type Search ¶
type SearchIterator ¶
type SearchIterator func(search *Search, ul UserLoader) error
type TGUser ¶
type TGUser struct { Username string `json:"username"` ID TelegramID `json:"id"` Started bool `json:"started"` LastUpdated time.Time `json:"last_updated"` Searches map[string]bool `json:"searches"` SubmissionUsers map[string]bool `json:"submission_users"` JournalUsers map[string]bool `json:"journal_users"` }
TGUser represents a telegram user in the database.
type TelegramID ¶
type TelegramID int64
TelegramID is the type of Telegram entity IDs.
func (TelegramID) Key ¶
func (id TelegramID) Key() []byte
type UserIterator ¶
type UserIterator func(faUser *FAUser, ul UserLoader) error
type UserLoader ¶
type UserLoader func(id TelegramID) (*TGUser, error)
UserLoader is used to load a user while iterating over saved items.
Click to show internal directories.
Click to hide internal directories.