Documentation ¶
Index ¶
- func AddColumn(dbMap *gorp.DbMap, db string, table string, columnToAdd string, ...)
- func DecodeHashList(hashList HashList) ([]chainhash.Hash, error)
- func DisableLog()
- func GetDbMap(APISecret, baseURL, user, password, hostname, port, database string) *gorp.DbMap
- func GetUserCount(dbMap *gorp.DbMap) int64
- func GetUserCountActive(dbMap *gorp.DbMap) int64
- func GetUserMax(dbMap *gorp.DbMap) int64
- func InsertEmailChange(dbMap *gorp.DbMap, emailChange *EmailChange) error
- func InsertLowFeeTicket(dbMap *gorp.DbMap, lowFeeTicket *LowFeeTicket) error
- func InsertPasswordReset(dbMap *gorp.DbMap, passwordReset *PasswordReset) error
- func InsertUser(dbMap *gorp.DbMap, user *User) error
- func SetUserAPIToken(dbMap *gorp.DbMap, APISecret string, baseURL string, id int64) (string, error)
- func UseLogger(logger slog.Logger)
- func ValidateHashList(hashList HashList) error
- type EmailChange
- type HashList
- type LowFeeTicket
- type PasswordReset
- type Session
- type User
- func GetAllCurrentMultiSigScripts(dbMap *gorp.DbMap) ([]User, error)
- func GetUserByEmail(dbMap *gorp.DbMap, email string) (user *User)
- func GetUserById(dbMap *gorp.DbMap, id int64) (user *User, err error)
- func UpdateUserByID(dbMap *gorp.DbMap, id int64, multiSigAddr string, multiSigScript string, ...) (user *User)
- type UserToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddColumn ¶
func AddColumn(dbMap *gorp.DbMap, db string, table string, columnToAdd string, dataSpec string, colAfter string, defaultQry string)
AddColumn checks if a column exists and adds it if it doesn't
func DecodeHashList ¶
DecodeHashList attempts to decode each hash string in the given HashList, returning a non-nil error if any string in the list is not a valid hashes.
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
func GetUserCount ¶
GetUserCount gives a count of all users
func GetUserCountActive ¶
GetUserCountActive gives a count of all users who have submitted an address
func InsertEmailChange ¶
func InsertEmailChange(dbMap *gorp.DbMap, emailChange *EmailChange) error
func InsertLowFeeTicket ¶
func InsertLowFeeTicket(dbMap *gorp.DbMap, lowFeeTicket *LowFeeTicket) error
InsertLowFeeTicket inserts a user into the DB
func InsertPasswordReset ¶
func InsertPasswordReset(dbMap *gorp.DbMap, passwordReset *PasswordReset) error
func InsertUser ¶
InsertUser inserts a user into the DB
func SetUserAPIToken ¶
SetUserAPIToken generates and saves a unique API Token for a user.
func UseLogger ¶
UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.
func ValidateHashList ¶
ValidateHashList ensures that all strings in the HashList are valid Decred hashes. If all are valid, the returned error will be nil.
Types ¶
type EmailChange ¶
type HashList ¶
type HashList []string
HashList represents a slice of hash strings.
func (HashList) ToStringSlice ¶
ToStringSlice satisfies gorp's internal "stringer" interface used by expandSliceArgs. It is a trivial conversion since the underlying type of HashList is a []string, but if a HashList is provided to a gorp query/transaction then ToStringSlice must be implemented to obtain the []string type in expandSliceArgs.
type LowFeeTicket ¶
type LowFeeTicket struct { Id int64 `db:"LowFeeTicketID"` AddedByUid int64 TicketAddress string TicketHash string TicketExpiry int64 Voted int64 Created int64 Expires int64 }
func GetVotableLowFeeTickets ¶
func GetVotableLowFeeTickets(dbMap *gorp.DbMap) ([]LowFeeTicket, error)
type PasswordReset ¶
type User ¶
type User struct { Id int64 `db:"UserId"` Email string Username string Password []byte MultiSigAddress string MultiSigScript string PoolPubKeyAddr string UserPubKeyAddr string UserFeeAddr string HeightRegistered int64 EmailVerified int64 EmailToken string APIToken string VoteBits int64 VoteBitsVersion int64 }
func UpdateUserByID ¶
func UpdateUserByID(dbMap *gorp.DbMap, id int64, multiSigAddr string, multiSigScript string, poolPubKeyAddr string, userPubKeyAddr string, userFeeAddr string, height int64) (user *User)
UpdateUserByID updates a user, specified by id, in the DB with a new multiSigAddr, multiSigScript, multiSigScript, pool pubkey address, user pub key address, and fee address. Unchanged are the user's ID, email, username and password.
func (*User) HashPassword ¶
type UserToken ¶
type UserToken [userTokenSize]byte
UserToken is a token used in user registration, and email and password changes.
func UserTokenFromStr ¶
UserTokenFromStr attempts to decode the token string into a UserToken.