Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureApiEnabled(r *Repo, userId int64) error
- func GenNonce(digits int) string
- func IsGroupChat(m *tb.Message) bool
- func LogDbf(r *Repo, level helpers.Level, m *tb.Message, format string, v ...interface{})
- type Repo
- func (r *Repo) AddTemplate(chatId int64, name, template string) error
- func (r *Repo) ArchiveTransactions(m *tb.Message) error
- func (r *Repo) CreateApiVerification(userId int64) (nonce string, err error)
- func (r *Repo) DeleteAllCacheEntries(m *tb.Message) error
- func (r *Repo) DeleteAllUserSettings(tgChatId int64) error
- func (r *Repo) DeleteCache(m *tb.Message)
- func (r *Repo) DeleteCacheEntries(m *tb.Message, t string, value string) (sql.Result, error)
- func (r *Repo) DeleteTemplates(m *tb.Message) error
- func (r *Repo) DeleteTransaction(m *tb.Message, isArchived bool, elementId int) (int64, error)
- func (r *Repo) DeleteTransactions(m *tb.Message) (int64, error)
- func (r *Repo) DeleteUser(m *tb.Message) error
- func (r *Repo) EnrichUserData(m *tb.Message) error
- func (r *Repo) FillCache(m *tb.Message) error
- func (r *Repo) GetCacheHints(m *tb.Message, key string) ([]string, error)
- func (r *Repo) GetTemplates(m *tb.Message, name string) ([]*TemplateResult, error)
- func (r *Repo) GetTokenChatId(token string) (chatId int64, err error)
- func (r *Repo) GetTransactions(m *tb.Message, isArchived bool) ([]*TransactionResult, error)
- func (r *Repo) GetUserSetting(setting string, tgChatId int64) (exists bool, val string, err error)
- func (r *Repo) GetUsersToNotify() (*sql.Rows, error)
- func (r *Repo) HealthGetCacheStats() (accTo, accFrom, txDesc, other int, err error)
- func (r *Repo) HealthGetLogs(lastHours int) (errors int, warnings int, err error)
- func (r *Repo) HealthGetTransactions() (open int, archived int, err error)
- func (r *Repo) HealthGetUserCount() (count int, err error)
- func (r *Repo) HealthGetUsersActiveCounts(maxDiffHours int) (count int, err error)
- func (r *Repo) IndividualsWithNotifications(chatId string) (recipients []string)
- func (r *Repo) PutCacheHints(m *tb.Message, values map[string]string) error
- func (r *Repo) RecordTransaction(chatId int64, tx string) error
- func (r *Repo) RevokeApiToken(token string) (count int64, err error)
- func (r *Repo) RmTemplate(chatId int64, name string) (bool, error)
- func (r *Repo) SetUserSetting(setting string, value string, tgChatId int64) (err error)
- func (r *Repo) UserGetCurrency(m *tb.Message) string
- func (r *Repo) UserGetNotificationSetting(m *tb.Message) (daysDelay, hour int, err error)
- func (r *Repo) UserGetTag(m *tb.Message) string
- func (r *Repo) UserGetTzOffset(m *tb.Message) (tzOffset int)
- func (r *Repo) UserIsAdmin(m *tb.Message) (isAdmin bool)
- func (r *Repo) UserSetCurrency(m *tb.Message, currency string) error
- func (r *Repo) UserSetNotificationSetting(m *tb.Message, daysDelay, hour int) error
- func (r *Repo) UserSetTag(m *tb.Message, tag string) error
- func (r *Repo) UserSetTzOffset(m *tb.Message, timezoneOffset int) error
- func (r *Repo) VerifyApiToken(userId int64, nonce string) (token string, err error)
- type TemplateResult
- type TransactionResult
- type User
- type UserCacheEntry
Constants ¶
View Source
const CACHE_VALIDITY = 15 * time.Minute
View Source
const DB_TABLE_TEMPLATES = "bot::template"
Variables ¶
View Source
var CACHE_LOCAL = make(map[int64]map[string][]string)
View Source
var TEST_MODE = false
View Source
var USER_CACHE = make(map[int64]*UserCacheEntry)
Functions ¶
func EnsureApiEnabled ¶ added in v1.0.0
func IsGroupChat ¶ added in v0.19.0
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) CreateApiVerification ¶ added in v1.0.0
func (*Repo) DeleteAllCacheEntries ¶ added in v0.21.0
func (*Repo) DeleteAllUserSettings ¶ added in v1.0.0
func (*Repo) DeleteCache ¶
TODO: Prune cache: Free from old entries after time span (async)
func (*Repo) DeleteCacheEntries ¶
func (*Repo) DeleteTransaction ¶ added in v0.20.0
func (*Repo) GetCacheHints ¶
func (*Repo) GetTemplates ¶
func (*Repo) GetTokenChatId ¶ added in v1.0.0
func (*Repo) GetTransactions ¶
func (*Repo) GetUserSetting ¶
func (*Repo) HealthGetCacheStats ¶
func (*Repo) HealthGetLogs ¶
func (*Repo) HealthGetTransactions ¶
func (*Repo) HealthGetUserCount ¶
func (*Repo) HealthGetUsersActiveCounts ¶ added in v0.17.2
func (*Repo) IndividualsWithNotifications ¶
func (*Repo) PutCacheHints ¶
func (*Repo) RevokeApiToken ¶ added in v1.0.0
func (*Repo) SetUserSetting ¶
func (*Repo) UserGetNotificationSetting ¶
func (*Repo) UserSetNotificationSetting ¶
* UserSetNotificationSetting sets user's notification settings. If daysDelay is < 0, schedule will be disabled.
func (*Repo) UserSetTzOffset ¶
type TemplateResult ¶
type TransactionResult ¶
type UserCacheEntry ¶
Click to show internal directories.
Click to hide internal directories.