contextds

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRead

func GetRead(ctx context.Context) (datastore.Read, bool)

GetRead retrieves the read batch from the context.

func GetWrite

func GetWrite(ctx context.Context) (datastore.Write, bool)

GetWrite retrieves the write batch from the context.

func WithRead

func WithRead(ctx context.Context, batch datastore.Read) context.Context

WithRead adds a read batch to the context.

func WithWrite

func WithWrite(ctx context.Context, batch datastore.Write) context.Context

WithWrite adds a write batch to the context.

func WrapDatastore

func WrapDatastore(ds datastore.Datastore) datastore.Datastore

WrapsDatastore wraps around the given datastore.Datastore making its operations context-aware It intercepts datastore operations routing them to the current Write or Read if one exists on the context.

Types

type Datastore

type Datastore struct {
	// contains filtered or unexported fields
}

Datastore is a wrapper around a datastore.Datastore that provides context-aware operations. See WrapDatastore.

func (*Datastore) Batch

func (ds *Datastore) Batch(ctx context.Context) (datastore.Batch, error)

func (*Datastore) Close

func (ds *Datastore) Close() error

func (*Datastore) Delete

func (ds *Datastore) Delete(ctx context.Context, key datastore.Key) error

func (*Datastore) Get

func (ds *Datastore) Get(ctx context.Context, key datastore.Key) ([]byte, error)

func (*Datastore) GetSize

func (ds *Datastore) GetSize(ctx context.Context, key datastore.Key) (int, error)

func (*Datastore) Has

func (ds *Datastore) Has(ctx context.Context, key datastore.Key) (bool, error)

func (*Datastore) NewTransaction

func (ds *Datastore) NewTransaction(ctx context.Context, readOnly bool) (datastore.Txn, error)

func (*Datastore) Put

func (ds *Datastore) Put(ctx context.Context, key datastore.Key, value []byte) error

func (*Datastore) Query

func (ds *Datastore) Query(ctx context.Context, q query.Query) (query.Results, error)

func (*Datastore) Sync

func (ds *Datastore) Sync(ctx context.Context, prefix datastore.Key) error

Jump to

Keyboard shortcuts

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