Documentation
¶
Index ¶
- Constants
- func IsAddressPresent(b *Address) (bool, error)
- func IsBlockPresent(blockHash string) (bool, error)
- func StoreAddress(b *Address) error
- func StoreAddressIfNotPresent(b *Address) error
- func StoreBlock(b *Block) error
- func StoreTransaction(txn *Transaction) error
- type Address
- type Block
- type Transaction
- type TransactionSummary
- type User
- type UserEditable
- type UserToken
- type V
Constants ¶
View Source
const AddrCollectionName = "address"
View Source
const BlockCollectionName = "blocks"
View Source
const TransactionCollectionName = "txns"
Variables ¶
This section is empty.
Functions ¶
func IsAddressPresent ¶
func IsBlockPresent ¶
IsBlockPresent checks if the block with the hash provided is present or not
func StoreAddress ¶
func StoreBlock ¶
func StoreTransaction ¶
func StoreTransaction(txn *Transaction) error
Types ¶
type Address ¶
type Address struct { Addr string `json:"address" bson:"address"` Sent uint Received uint Balance uint Transactions []*TransactionSummary `json:"last_txs,omitempty" bson:"last_txs" ` }
func GetAddressFromDB ¶
type Block ¶
type Block struct { Hash string `bson:"hash" json:"hash"` Confirmations uint `bson:"confirmation" json:"confirmation"` Size uint `bson:"size" json:"size"` Height uint `bson:"height" json:"height"` Version uint `bson:"version" json:"version"` MerkeleRoot string `bson:"merkeleroot" json:"merkeleroot"` Mint float64 `bson:"mint" json:"mint"` Time uint `bson:"time" json:"time"` Difficulty float64 `bson:"difficulty" json:"difficulty"` Blocktrust string `bson:"blocktrust" json:"blocktrust"` Chaintrust string `bson:"chaintrust" json:"chaintrust"` Nextblockhash string `bson:"nextblockhash" json:"nextblockhash"` Previousblockhash string `bson:"previousblockhash" json:"previousblockhash"` EntropyBit int `bson:"entropybit" json:"entropybit"` Modifier string `bson:"modifier" json:"modifier"` Modifierchecksum string `bson:"modifierchecksum" json:"modifierchecksum"` Signature string `bson:"signature" json:"signature"` }
type Transaction ¶
type Transaction struct { TxID string `json:"txid" bson:"txid"` Blockhash string `json:"blockhash" bson:"blockhash"` Blockindex uint `json:"blockindex" bson:"blockindex"` Timestamp uint `json:"timestamp" bson:"timestamp"` Total uint `json:"total" bson:"total"` Vout []*V `json:"vout" bson:"vout"` Vin []*V `json:"vin" bson:"vin"` }
type TransactionSummary ¶
type User ¶
type User struct { ID bson.ObjectId `bson:"_id" json:"-"` PurseHash string `bson:"purseHash" json:"purseHash"` Token string `bson:"token" json:"token"` HasAutoUpdate bool `bson:"hasAutoUpdate" json:"hasAutoUpdate"` IsSynchronized bool `bson:"isSynchronized" json:"isSynchronized"` PursePrivateKey string `bson:"pursePrivateKey" json:"-"` TwitterUsername string `bson:"twitterUsername" json:"twitterUsername"` TwitterCheckedAt time.Time `bson:"twitterCheckedAt" json:"twitterCheckedAt"` BootstrapNodes []bson.ObjectId `bson:"bootstrapNodes" json:"-"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` }
User model.
func (User) GetByPurseHash ¶
GetByPurseHash gets a user from the database by their Purse Account address hash.
type UserEditable ¶
type UserEditable struct { HasAutoUpdate bool `bson:"hasAutoUpdate" json:"hasAutoUpdate"` IsSynchronized bool `bson:"isSynchronized" json:"isSynchronized"` TwitterUsername string `bson:"twitterUsername" json:"twitterUsername"` }
UserEditable model.
type UserToken ¶
type UserToken struct { ID bson.ObjectId `bson:"_id" json:"-"` Challenge string `bson:"challenge" json:"challenge"` PurseHash string `bson:"purseHash" json:"purseHash"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` }
UserToken model.
func (UserToken) GetByPurseHash ¶
GetByPurseHash finds a user token in the database by its Purse Account address hash.
Click to show internal directories.
Click to hide internal directories.