Documentation
¶
Index ¶
- type DBManager
- func (db *DBManager) CheckAndDeductBalance(uid []byte, costAtoms int64, debug bool) (bool, error)
- func (dm *DBManager) Close() error
- func (dm *DBManager) GetBalance(uid string) (int64, error)
- func (db *DBManager) GetUserBalance(uid []byte) (float64, error)
- func (dm *DBManager) UpdateBalance(uid string, amount int64) error
- type UserBalance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBManager ¶
type DBManager struct {
// contains filtered or unexported fields
}
DBManager handles database operations
func NewDBManager ¶
NewDBManager creates a new database manager
func (*DBManager) CheckAndDeductBalance ¶
CheckAndDeductBalance checks if a user has sufficient balance and deducts the cost if they do. costAtoms is the cost in atoms (1 DCR = 1e11 atoms). The caller is responsible for converting from USD/DCR to atoms before calling this function. Returns true if the operation was successful, false otherwise.
func (*DBManager) GetBalance ¶
GetBalance retrieves a user's balance
func (*DBManager) GetUserBalance ¶
GetUserBalance gets the current balance of a user in DCR
type UserBalance ¶
UserBalance represents a user's balance in the database
Click to show internal directories.
Click to hide internal directories.