Documentation ¶
Index ¶
- type Connection
- func (c *Connection) ClearState() error
- func (c *Connection) CountCollectionDocs(collectionName string, filter bson.M) (int64, error)
- func (c *Connection) GetAttestationState(urnHash string) (*attestation.State, error)
- func (c *Connection) GetDocs(collectionName string, limit int64, skip int64, filter bson.M) ([]bmap.Tx, error)
- func (c *Connection) GetIdentityState(idKey string) (*identity.State, error)
- func (c *Connection) GetIdentityStateByTxID(txid string) (*identity.State, error)
- func (c *Connection) GetIdentityStateFromAddress(address string) (*identity.State, error)
- func (c *Connection) GetStateDocs(collectionName string, limit int64, skip int64, filter bson.M) ([]bson.M, error)
- func (c *Connection) InsertOne(collectionName string, data bson.M) (interface{}, error)
- func (c *Connection) Update(collectionName string, filter interface{}, update bson.M) (interface{}, error)
- func (c *Connection) Upsert(collectionName string, filter interface{}, update bson.M) (interface{}, error)
- func (c *Connection) UpsertOne(collectionName string, filter interface{}, data bson.M) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
Connection is a mongo client
func Connect ¶
func Connect(ctx context.Context) (*Connection, error)
Connect establishes a connection to the mongo db
func (*Connection) ClearState ¶
func (c *Connection) ClearState() error
ClearState will clear the state (drop collection)
func (*Connection) CountCollectionDocs ¶
CountCollectionDocs returns the number of records in a given collection
func (*Connection) GetAttestationState ¶
func (c *Connection) GetAttestationState(urnHash string) (*attestation.State, error)
GetAttestationState gets a single document for a state collection
func (*Connection) GetDocs ¶
func (c *Connection) GetDocs(collectionName string, limit int64, skip int64, filter bson.M) ([]bmap.Tx, error)
GetDocs gets a number of documents for a given collection
func (*Connection) GetIdentityState ¶
func (c *Connection) GetIdentityState(idKey string) (*identity.State, error)
GetIdentityState gets a single document for a state collection
func (*Connection) GetIdentityStateByTxID ¶
func (c *Connection) GetIdentityStateByTxID(txid string) (*identity.State, error)
GetIdentityStateByTxID gets a single document for a state collection by txid
func (*Connection) GetIdentityStateFromAddress ¶
func (c *Connection) GetIdentityStateFromAddress(address string) (*identity.State, error)
GetIdentityStateFromAddress gets a single document for a state collection
func (*Connection) GetStateDocs ¶
func (c *Connection) GetStateDocs(collectionName string, limit int64, skip int64, filter bson.M) ([]bson.M, error)
GetStateDocs gets a number of documents for a given state collection
func (*Connection) InsertOne ¶
func (c *Connection) InsertOne(collectionName string, data bson.M) (interface{}, error)
InsertOne connects and inserts the provided data into the provided collection
func (*Connection) Update ¶
func (c *Connection) Update(collectionName string, filter interface{}, update bson.M) (interface{}, error)
Update connects and updates the provided data into the provided collection NOTE: This function can update multiple records if the filter is not restrictive