address

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

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

Index

Constants

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

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

View Source
const CreateTableTxRelation = `` /* 458-byte string literal not displayed */

CreateTableTxRelation is a SQL string that creates the "address_tx" table.

The "address_tx" table has a foreign key reference to the "address" and "entry" 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 "address" if it does not exist. If successful, the row id of adr is returned.

func InsertTxRelation

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

InsertTxRelation inserts a row into "address_tx" relating the adrID with the entryID and a transaction direction, to. If successful, the row id for the new row in "address_tx" is returned.

func SelectCount

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

SelectCount returns the number of rows in "address". If nonZeroOnly is true, then only count the address 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 "address" 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