Documentation
¶
Index ¶
- Constants
- type Bet
- type Bets
- func (db *Bets) ByID(id int) (bet Bet, _ error)
- func (db *Bets) ByUserID(chat Chat) (bets []Bet, _ error)
- func (db *Bets) Count(chat Chat) (i int, _ error)
- func (db *Bets) Create(bet *azartio.Bet, chat Chat) error
- func (db *Bets) MakeDoneByChat(result *azartio.RollResult, user Chat, chat Chat) error
- func (db *Bets) NotDoneByChat(chat Chat) (bets []Bet, _ error)
- func (db *Bets) NotDoneByUserID(user Chat, chat Chat) (bets []Bet, _ error)
- type BetsStorage
- type Chat
- type DB
- type Group
- type Groups
- type GroupsStorage
- type Payment
- type Payments
- type PaymentsStorage
- type User
- type Users
- func (db *Users) AddPerk(chat Chat, perk string) error
- func (db *Users) Balance(chat Chat) (a int64, _ error)
- func (db *Users) ByID(chat Chat) (usr User, _ error)
- func (db *Users) Charge(amount int64, chat Chat) error
- func (db *Users) Create(chat Chat, ref string) error
- func (db *Users) Exists(chat Chat) (has bool, _ error)
- func (db *Users) Friends(chat Chat) (i int, _ error)
- func (db *Users) IsLastBonusUsed(chat Chat) (bool, error)
- func (db *Users) Lang(chat Chat) (lang string, _ error)
- func (db *Users) Leaderboard() (users []User, _ error)
- func (db *Users) SetLang(chat Chat, lang string) error
- func (db *Users) SetSubscribed(chat Chat, sub bool) error
- func (db *Users) Subscribed(chat Chat) (sub bool)
- func (db *Users) UseBonus(chat Chat) error
- type UsersStorage
Constants ¶
View Source
const ( GroupStateNone = "none" GroupStateRolling = "rolling" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bets ¶
func (*Bets) MakeDoneByChat ¶
type BetsStorage ¶
type BetsStorage interface {
ByID(id int) (bet Bet, _ error)
Create(bet *azartio.Bet, chatID Chat) error
ByUserID(chat Chat) (bets []Bet, _ error)
Count(chat Chat) (int, error)
NotDoneByUserID(user Chat, chat Chat) (bets []Bet, _ error)
MakeDoneByChat(result *azartio.RollResult, user Chat, chat Chat) error
NotDoneByChat(chat Chat) (bets []Bet, _ error)
}
type DB ¶
type DB struct {
*sqlx.DB
Users UsersStorage
Groups GroupsStorage
Bets BetsStorage
Payments PaymentsStorage
}
type GroupsStorage ¶
type Payment ¶
type PaymentsStorage ¶
type User ¶
type User struct {
CreatedAt time.Time `sq:"created_at,omitempty"`
UpdatedAt time.Time `sq:"updated_at,omitempty"`
ID int `sq:"id,omitempty"`
Ref string `sq:"ref,omitempty"`
Balance int64 `sq:"balance,omitempty"`
LastBonus time.Time `sq:"last_bonus,omitempty"`
Subscribed bool `sq:"subscribed,omitempty"`
PerksArray pgtype.VarcharArray `db:"perks" sq:"perks,omitempty"`
}
type UsersStorage ¶
type UsersStorage interface {
Create(chat Chat, ref string) error
Exists(chat Chat) (bool, error)
Charge(amount int64, chat Chat) error
ByID(chat Chat) (usr User, _ error)
Balance(chat Chat) (a int64, _ error)
Friends(chat Chat) (int, error)
IsLastBonusUsed(chat Chat) (bool, error)
UseBonus(chat Chat) error
Subscribed(chat Chat) bool
SetSubscribed(chat Chat, s bool) error
Leaderboard() (users []User, _ error)
AddPerk(chat Chat, perk string) error
}
Click to show internal directories.
Click to hide internal directories.