Documentation ¶
Index ¶
- func NewSimpleTx(ds datastore.Datastore) dse.TxnExt
- func PostgresURL() (string, error)
- type SimpleTx
- func (bt *SimpleTx) Commit(ctx context.Context) error
- func (bt *SimpleTx) Delete(_ context.Context, key datastore.Key) error
- func (bt *SimpleTx) Discard(_ context.Context)
- func (bt *SimpleTx) Get(ctx context.Context, k datastore.Key) ([]byte, error)
- func (bt *SimpleTx) GetSize(ctx context.Context, k datastore.Key) (int, error)
- func (bt *SimpleTx) Has(ctx context.Context, k datastore.Key) (bool, error)
- func (bt *SimpleTx) Put(_ context.Context, key datastore.Key, val []byte) error
- func (bt *SimpleTx) Query(ctx context.Context, q query.Query) (query.Results, error)
- func (bt *SimpleTx) QueryExtended(q dse.QueryExt) (query.Results, error)
- type TxMapDatastore
- func (d *TxMapDatastore) Clone() (*TxMapDatastore, error)
- func (d *TxMapDatastore) Delete(ctx context.Context, key datastore.Key) error
- func (d *TxMapDatastore) Get(ctx context.Context, key datastore.Key) ([]byte, error)
- func (d *TxMapDatastore) NewTransaction(readOnly bool) (datastore.Txn, error)
- func (d *TxMapDatastore) NewTransactionExtended(readOnly bool) (dse.TxnExt, error)
- func (d *TxMapDatastore) Put(ctx context.Context, key datastore.Key, data []byte) error
- func (d *TxMapDatastore) Query(ctx context.Context, q query.Query) (query.Results, error)
- func (d *TxMapDatastore) QueryExtended(q dse.QueryExt) (query.Results, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSimpleTx ¶
NewSimpleTx creates a transaction.
func PostgresURL ¶
PostgresURL gets a Postgres database URL for test. It always creates a new database on the server so tests won't clash with each other. It connects to the server specified by PG_URL envvar if present, or starts a new Postgres docker container which stops automatically after 10 minutes.
Types ¶
type SimpleTx ¶
type SimpleTx struct {
// contains filtered or unexported fields
}
SimpleTx implements the transaction interface for datastores who do not have any sort of underlying transactional support.
type TxMapDatastore ¶
type TxMapDatastore struct { *datastore.MapDatastore // contains filtered or unexported fields }
TxMapDatastore is a in-memory datastore that satisfies TxnDatastore.
func NewTxMapDatastore ¶
func NewTxMapDatastore() *TxMapDatastore
NewTxMapDatastore returns a new TxMapDatastore.
func (*TxMapDatastore) Clone ¶
func (d *TxMapDatastore) Clone() (*TxMapDatastore, error)
Clone returns a cloned datastore.
func (*TxMapDatastore) Delete ¶
func (d *TxMapDatastore) Delete(ctx context.Context, key datastore.Key) error
Delete deletes a key.
func (*TxMapDatastore) Get ¶
func (d *TxMapDatastore) Get(ctx context.Context, key datastore.Key) ([]byte, error)
Get returns the value for a key.
func (*TxMapDatastore) NewTransaction ¶
func (d *TxMapDatastore) NewTransaction(readOnly bool) (datastore.Txn, error)
NewTransaction creates a transaction. A read-only transaction should be indicated with readOnly equal true.
func (*TxMapDatastore) NewTransactionExtended ¶
func (d *TxMapDatastore) NewTransactionExtended(readOnly bool) (dse.TxnExt, error)
NewTransactionExtended creates an extended transaction. A read-only transaction should be indicated with readOnly equal true.
func (*TxMapDatastore) Put ¶
func (d *TxMapDatastore) Put(ctx context.Context, key datastore.Key, data []byte) error
Put sets the value of a key.
func (*TxMapDatastore) QueryExtended ¶
QueryExtended executes an extended query.