mongo

package
v0.0.0-...-9ae6259 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorNoUserInfo string = "No information returned with the given address"

ErrorNoUserInfo indicates no information returned with successful state code

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo interface {
	PutUserHistory(doc *UserHistory) error
	GetUserHistory(addr string) (*UserHistory, error)
}

Mongo deals with mongo database stuffs

func New

func New(conn *bongo.Connection) Mongo

New creates an instance of Mongo

type Unspent

type Unspent struct {
	Transaction  string
	VOutIdx      uint64
	ScriptPubKey string
	Amount       uint64
	BlockTime    uint64
}

Unspent is used for the store of User's unspent transaction information, kept in UserHistory

type UserHistory

type UserHistory struct {
	Address      string            `json:"a"`
	Timestamp    time.Time         `json:"t"`
	Subtotal     int64             `json:"sbtl"`
	Spents       map[string]bool   `json:"spts"`
	UnspentAmts  map[string]uint64 `json:"usptsams"`
	Unspents     []Unspent         `json:"uspts"`
	Shadowspents []string          `json:"sdspts"`
	Transactions []string          `json:"txs"`
	Skipped      uint64            `json:"skd"`
}

UserHistory keeps all revelant information about balance, transaction history, unspent... Note that it can also be used for the struct of user data in redis, well implemented in json representation as bytes array

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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