db

package
v0.0.0-...-499c518 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyDBClient mongo.Collection
View Source
var MainDBClient mongo.Collection
View Source
var RelDBClient mongo.Collection

Functions

func AddKey

func AddKey(name string, derivationPath string, address string, publicKey []byte, encPrivateKey []byte)

Add new key to the account

func CountNumberOfKeys

func CountNumberOfKeys() int64

func CountNumberOfTransactions

func CountNumberOfTransactions() int64

func Insert

func Insert(dbItem MainDBItem)

Saves a transaction

func InsertRelated

func InsertRelated(dbItem MainDBItem)

Saves a transaction related to this account

Types

type KeyDBItem

type KeyDBItem struct {
	Name           string
	DerivationPath string
	Address        string
	PublicKey      []byte
	EncPrivateKey  []byte
}

Key structure

func GetKeyByName

func GetKeyByName(name string) KeyDBItem

Gets a single keypair by its given name

func GetKeyPairs

func GetKeyPairs() []KeyDBItem

Get all keypairs in this account as a list

func GetsKeyByDerivationPath

func GetsKeyByDerivationPath(derivationPath string) []KeyDBItem

GetsKeyByDerivationPath fetches a list of keys with given a derivation path

type MainDBItem

type MainDBItem struct {
	Index                   uint64
	Hash                    []byte
	PrevHash                []byte
	Date                    time.Time
	ObjectType              byte
	SubType                 byte
	Data                    []byte
	Targets                 []string
	Signatures              [][]byte
	PublicKeys              [][]byte
	DerivationPaths         [][]byte
	OrganizationTransaction []byte // Genesis transaction of the organization referred by this transaction
}

Transaction structure

func Get

func Get(txhash []byte) MainDBItem

Gets the transaction by its hash

func GetByObjectType

func GetByObjectType(objectType byte) []MainDBItem

Get organization transactions

func GetLastTransaction

func GetLastTransaction() MainDBItem

Gets the last transaction

Jump to

Keyboard shortcuts

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