Documentation ¶
Overview ¶
Package db provides the persistent and in-memory store.
Package db provides the persistent store.
Index ¶
- type DB
- func (db *DB) CheckPendingPayment(id string) (*api.Receipt, error)
- func (db *DB) Close() error
- func (db *DB) Dump() (string, error)
- func (db *DB) Flush(pending, alerts bool) error
- func (db *DB) GetAlertEntry() (*api.Superchat, error)
- func (db *DB) GetNMostRecent(n int) ([]api.Superchat, time.Time, error)
- func (db *DB) NewPendingPayment(args *api.PendingPayment) error
- func (db *DB) Stats() (*Stats, error)
- type DumpEntry
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is the persistent and in-memory store.
func (*DB) CheckPendingPayment ¶
CheckPendingPayment checks on a pending payment by XMR payment ID.
func (*DB) Dump ¶
Dump dumps the DB to a JSONL (https://jsonlines.org/) file in the working directory.
func (*DB) GetAlertEntry ¶
GetAlertEntry returns the next alert entry after advancing the state. This may silently skip entries that are "stale" to prevent the backlog from growing too far.
func (*DB) GetNMostRecent ¶
GetNMostRecent returns the N most recent superchats. The result is further limited by the `db.max_count` config option.
func (*DB) NewPendingPayment ¶
func (db *DB) NewPendingPayment(args *api.PendingPayment) error
NewPendingPayment creates a new pending payment.
type DumpEntry ¶
type DumpEntry struct { // Seq is the unique sequence number for a paid superchat. Seq uint64 `json:"seq,omitempty"` // PaymentID is the XMR payment ID of a pending superchat. PaymentID string `json:"payment_id,omitempty"` // Name is the superchat sender. Name string `json:"name"` // Message is the superchat message. Message string `json:"msg,omitempty"` // Amount is the amount received. Amount *xmr.Quantity `json:"amount"` // ShowAmount indicates if the amount should be shown on stream. ShowAmount bool `json:"show_amount,omitempty"` // TxID is the XMR TxID of a paid superchat. TxID string `json:"txid,omitempty"` // Timestamp is the timestamp of when the superchat was created/paid-for. Timestamp time.Time `json:"ts"` // NotAlerted indicates if the superchat has not been displayed by // the alert view. NotAlerted bool `json:"not_alerted,omitempty"` }
DumpEntry is a JSONL dump export record.