Exemplo n.º 1
0
func UpdatePayment(c db.MConn, p *Payment) {
	p.Updated = time.Now().Unix()
	_, err := c.Exec(
		`UPDATE payment SET blockhash=?, blockheight=?, orphaned=?, time=?, updated=? WHERE tx_id=? AND vout=?`,
		p.Blockhash, p.Blockheight, p.Orphaned, p.Time, p.Updated, p.TxId, p.Vout,
	)
	if err != nil {
		panic(err)
	}
}
Exemplo n.º 2
0
func SaveBalance(c db.MConn, balance *Balance) *Balance {
	_, err := c.Exec(
		`INSERT INTO account_balance (`+BalanceModel.FieldsInsert+`)
         VALUES (`+BalanceModel.Placeholders+`)`,
		balance,
	)
	if err != nil {
		panic(err)
	}
	return balance
}