Documentation ¶
Overview ¶
Package entries provides functions and SQL framents for working with the "entries" table, which stores factom.Entry with a valid flag.
Index ¶
- Constants
- func CheckUniquelyValid(conn *sqlite.Conn, id int64, hash *factom.Bytes32) (bool, error)
- func Insert(conn *sqlite.Conn, e factom.Entry, ebSeq uint32) (int64, error)
- func Select(stmt *sqlite.Stmt) (factom.Entry, error)
- func SelectByAddress(conn *sqlite.Conn, startHash *factom.Bytes32, adrs []factom.FAAddress, ...) ([]factom.Entry, error)
- func SelectByHash(conn *sqlite.Conn, hash *factom.Bytes32) (factom.Entry, error)
- func SelectByID(conn *sqlite.Conn, id int64) (factom.Entry, error)
- func SelectCount(conn *sqlite.Conn, validOnly bool) (int64, error)
- func SelectLatestValid(conn *sqlite.Conn) (factom.Entry, error)
- func SelectValidByHash(conn *sqlite.Conn, hash *factom.Bytes32) (factom.Entry, error)
- func SetValid(conn *sqlite.Conn, id int64) error
Constants ¶
const CreateTable = `` /* 452-byte string literal not displayed */
CreateTable is a SQL string that creates the "entries" table.
The "entries" table has a foreign key reference to the "eblocks" table, which must exist first.
const SelectWhere = `SELECT "hash", "data", "timestamp" FROM "entries" WHERE `
SelectWhere is a SQL fragment for retrieving rows from the "entries" table with Select().
Variables ¶
This section is empty.
Functions ¶
func CheckUniquelyValid ¶
CheckUniquelyValid returns true if there are no valid entries earlier than id that have the same hash. If id is 0, then all entries are checked.
func Insert ¶
Insert e into the "entries" table with the EBlock reference ebSeq. If successful, the new row id of e is returned.
func Select ¶
Select the next factom.Entry from the given prepared Stmt.
The Stmt must be created with a SQL string starting with SelectWhere.
func SelectByAddress ¶
func SelectByAddress(conn *sqlite.Conn, startHash *factom.Bytes32, adrs []factom.FAAddress, nfTkns fat1.NFTokens, toFrom, order string, page, limit uint) ([]factom.Entry, error)
SelectByAddress returns all the factom.Entry where adrs and nfTkns were involved in the valid transaction, for the given pagination range.
Pages start at 1.
TODO: This should probably be moved out of the entries package and into a db package that is more specific to FAT0 and FAT1.
func SelectByHash ¶
SelectByHash returns the first factom.Entry with hash.
func SelectByID ¶
SelectByID returns the factom.Entry at row id.
func SelectCount ¶
SelectCount returns the total number of rows in the "entries" table. If validOnly is true, only the rows where "valid" = true are counted.
func SelectLatestValid ¶
SelectLatestValid returns the most recent valid factom.Entry.
func SelectValidByHash ¶
SelectValidByHash returns the first valid factom.Entry with hash.
Types ¶
This section is empty.