entries

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: MIT Imports: 9 Imported by: 0

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

View Source
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.

View Source
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

func CheckUniquelyValid(conn *sqlite.Conn,
	id int64, hash *factom.Bytes32) (bool, error)

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

func Insert(conn *sqlite.Conn, e factom.Entry, ebSeq uint32) (int64, error)

Insert e into the "entries" table with the EBlock reference ebSeq. If successful, the new row id of e is returned.

func Select

func Select(stmt *sqlite.Stmt) (factom.Entry, error)

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

func SelectByHash(conn *sqlite.Conn, hash *factom.Bytes32) (factom.Entry, error)

SelectByHash returns the first factom.Entry with hash.

func SelectByID

func SelectByID(conn *sqlite.Conn, id int64) (factom.Entry, error)

SelectByID returns the factom.Entry at row id.

func SelectCount

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

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

func SelectLatestValid(conn *sqlite.Conn) (factom.Entry, error)

SelectLatestValid returns the most recent valid factom.Entry.

func SelectValidByHash

func SelectValidByHash(conn *sqlite.Conn, hash *factom.Bytes32) (factom.Entry, error)

SelectValidByHash returns the first valid factom.Entry with hash.

func SetValid

func SetValid(conn *sqlite.Conn, id int64) error

SetValid marks the entry valid at the id'th row of the "entries" table.

Types

This section is empty.

Jump to

Keyboard shortcuts

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