models

package
v1.1.2-0...-a7c8ed4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func GetDbMap

func GetDbMap(APISecret, baseURL, user, password, hostname, port, database string) *gorp.DbMap

func GetUserCount

func GetUserCount(dbMap *gorp.DbMap) int64

GetUserCount gives a count of all users

func GetUserCountActive

func GetUserCountActive(dbMap *gorp.DbMap) int64

GetUserCountActive gives a count of all users who have submitted an address

func GetUserMax

func GetUserMax(dbMap *gorp.DbMap) int64

GetUserMax gives the last userid

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

func InsertUser(dbMap *gorp.DbMap, user *User) error

InsertUser inserts a user into the DB

func SetUserAPIToken

func SetUserAPIToken(dbMap *gorp.DbMap, APISecret string, baseURL string,
	id int64) error

SetUserAPIToken generates and saves a unique API Token for a user.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type EmailChange

type EmailChange struct {
	Id       int64 `db:"EmailChangeID"`
	UserId   int64
	NewEmail string
	Token    string
	Created  int64
	Expires  int64
}

type LowFeeTicket

type LowFeeTicket struct {
	Id            int64 `db:"LowFeeTicketID"`
	AddedByUid    int64
	TicketAddress string
	TicketHash    string
	TicketExpiry  int64
	Voted         int64
	Created       int64
	Expires       int64
}

func GetAllLowFeeTickets

func GetAllLowFeeTickets(dbMap *gorp.DbMap) ([]LowFeeTicket, error)

func GetVotableLowFeeTickets

func GetVotableLowFeeTickets(dbMap *gorp.DbMap) ([]LowFeeTicket, error)

type PasswordReset

type PasswordReset struct {
	Id      int64 `db:"PasswordResetID"`
	UserId  int64
	Token   string
	Created int64
	Expires int64
}

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 GetAllCurrentMultiSigScripts

func GetAllCurrentMultiSigScripts(dbMap *gorp.DbMap) ([]User, error)

func GetUserByEmail

func GetUserByEmail(dbMap *gorp.DbMap, email string) (user *User)

func GetUserById

func GetUserById(dbMap *gorp.DbMap, id int64) (user *User, err error)

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

func (user *User) HashPassword(password string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL