Documentation ¶
Overview ¶
Package mongo implements the interface for MongoDB.
Index ¶
- type Mongo
- func (m *Mongo) AddAddress(a store.Address, net string) ([]byte, error)
- func (m *Mongo) CloseMongo() error
- func (m *Mongo) DeleteExplorer(net string) (err error)
- func (m *Mongo) GetAddresses(net []string) ([]store.ListenedAddresses, error)
- func (m *Mongo) LoadExplorer(net string) (ne store.NetExplorer, err error)
- func (m *Mongo) RemoveAddress(a store.Address, net string) error
- func (m *Mongo) SaveExplorer(net string, ne store.NetExplorer) (err error)
- type MongoAddress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
Mongo implements a connection to a MongoDB database.
func (*Mongo) AddAddress ¶
AddAddress saves an address if the address does not already exist.
func (*Mongo) CloseMongo ¶
CloseMongo will close a database connection. Must be called at termination time.
func (*Mongo) DeleteExplorer ¶
DeleteExplorer deletes from db the NetExplorer for the indicated blockchain.
func (*Mongo) GetAddresses ¶
func (m *Mongo) GetAddresses(net []string) ([]store.ListenedAddresses, error)
GetAddresses returns the addresses or objects monitored for the network or blockchains indicated in the net slice.
func (*Mongo) LoadExplorer ¶
func (m *Mongo) LoadExplorer(net string) (ne store.NetExplorer, err error)
LoadExplorer loads from db the NetExplorer type for the indicated blockchain.
func (*Mongo) RemoveAddress ¶
RemoveAddress deletes an address from the database.
func (*Mongo) SaveExplorer ¶
func (m *Mongo) SaveExplorer(net string, ne store.NetExplorer) (err error)
SaveExplorer saves to db the NetExplorer for the indicated blockchain.
type MongoAddress ¶
type MongoAddress struct { ID primitive.ObjectID `json:"_id" bson:"_id"` Name string `json:"name,omitempty" bson:"name,omitempty"` Addr string `json:"address" bson:"address"` }
MongoAddress implements a store address to MongoDB.
func (MongoAddress) Address ¶
func (a MongoAddress) Address() store.Address
Address converts a MongoAddress to store.Address type.