addresses

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package addresses provides functions and SQL framents for working with the "addresses" table, which stores factom.FAAddress with its balance.

Index

Constants

View Source
const CreateTable = `` /* 243-byte string literal not displayed */

CreateTable is a SQL string that creates the "addresses" table.

View Source
const CreateTableTransactions = `` /* 512-byte string literal not displayed */

CreateTableTransactions is a SQL string that creates the "address_transactions" table.

The "address_transactions" table has a foreign key reference to the "addresses" and "entries" tables, which must exist first.

Variables

This section is empty.

Functions

func Add

func Add(conn *sqlite.Conn, adr *factom.FAAddress, add uint64) (int64, error)

Add adds add to the balance of adr, creating a new row in "addresses" if it does not exist. If successful, the row id of adr is returned.

func InsertTransactionRelation

func InsertTransactionRelation(conn *sqlite.Conn,
	adrID int64, entryID int64, to bool) (int64, error)

InsertTransactionRelation inserts a row into "address_transactions" relating the adrID with the entryID with the given transaction direction, to. If successful, the row id for the new row in "address_transactions" is returned.

func SelectCount

func SelectCount(conn *sqlite.Conn, nonZeroOnly bool) (int64, error)

SelectCount returns the number of rows in "addresses". If nonZeroOnly is true, then only count the addresses with a non zero balance.

func SelectID

func SelectID(conn *sqlite.Conn, adr *factom.FAAddress) (int64, error)

SelectID returns the row id for the given adr.

func SelectIDBalance

func SelectIDBalance(conn *sqlite.Conn,
	adr *factom.FAAddress) (adrID int64, bal uint64, err error)

SelectIDBalance returns the row id and balance for the given adr.

func Sub

func Sub(conn *sqlite.Conn,
	adr *factom.FAAddress, sub uint64) (id int64, txErr, err error)

Sub subtracts sub from the balance of adr creating the row in "addresses" if it does not exist and sub is 0. If successful, the row id of adr is returned. If subtracting sub would result in a negative balance, txErr is not nil and starts with "insufficient balance".

Types

This section is empty.

Jump to

Keyboard shortcuts

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