Documentation ¶
Index ¶
- type AfterBatchFunc
- type AfterDeleteFunc
- type AfterGetFunc
- type AfterHasFunc
- type AfterPutFunc
- type AfterQueryFunc
- type Batching
- func (bds *Batching) Batch() (datastore.Batch, error)
- func (bds *Batching) Close() error
- func (bds *Batching) Delete(key datastore.Key) error
- func (bds *Batching) Get(key datastore.Key) ([]byte, error)
- func (bds *Batching) GetSize(key datastore.Key) (int, error)
- func (bds *Batching) Has(key datastore.Key) (bool, error)
- func (bds *Batching) Put(key datastore.Key, value []byte) error
- func (bds *Batching) Query(q query.Query) (query.Results, error)
- func (bds *Batching) Sync(prefix datastore.Key) error
- type BeforeBatchFunc
- type BeforeDeleteFunc
- type BeforeGetFunc
- type BeforeHasFunc
- type BeforePutFunc
- type BeforeQueryFunc
- type Datastore
- func (hds *Datastore) Close() error
- func (hds *Datastore) Delete(key datastore.Key) error
- func (hds *Datastore) Get(key datastore.Key) ([]byte, error)
- func (hds *Datastore) GetSize(key datastore.Key) (int, error)
- func (hds *Datastore) Has(key datastore.Key) (bool, error)
- func (hds *Datastore) Put(key datastore.Key, value []byte) error
- func (hds *Datastore) Query(q query.Query) (query.Results, error)
- func (hds *Datastore) Sync(prefix datastore.Key) error
- type Option
- func WithAfterBatch(f AfterBatchFunc) Option
- func WithAfterDelete(f AfterDeleteFunc) Option
- func WithAfterGet(f AfterGetFunc) Option
- func WithAfterHas(f AfterHasFunc) Option
- func WithAfterPut(f AfterPutFunc) Option
- func WithAfterQuery(f AfterQueryFunc) Option
- func WithBeforeBatch(f BeforeBatchFunc) Option
- func WithBeforeDelete(f BeforeDeleteFunc) Option
- func WithBeforeGet(f BeforeGetFunc) Option
- func WithBeforeHas(f BeforeHasFunc) Option
- func WithBeforePut(f BeforePutFunc) Option
- func WithBeforeQuery(f BeforeQueryFunc) Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterBatchFunc ¶
AfterBatchFunc is a handler for the after Batch hook
type AfterDeleteFunc ¶
AfterDeleteFunc is a handler for the after Delete hook
type AfterGetFunc ¶
AfterGetFunc is a handler for the after Get hook
type AfterHasFunc ¶
AfterHasFunc is a handler for the after Has hook
type AfterPutFunc ¶
AfterPutFunc is a handler for the after Put hook
type AfterQueryFunc ¶
AfterQueryFunc is a handler for the after Query hook
type Batching ¶
type Batching struct {
// contains filtered or unexported fields
}
Batching is a datastore with hooks that also supports batching
func NewBatching ¶
NewBatching wraps a datastore.Batching datastore and adds optional before and after hooks into it's methods
func (*Batching) Batch ¶
Batch creates a container for a group of updates, it calls OnBeforeBatch and OnAfterBatch hooks.
func (*Batching) Delete ¶
Delete removes the value for given `key`, it calls OnBeforeDelete and OnAfterDelete hooks.
func (*Batching) Get ¶
Get retrieves the object `value` named by `key`, it calls OnBeforeGet and OnAfterGet hooks.
func (*Batching) Put ¶
Put stores the object `value` named by `key`, it calls OnBeforePut and OnAfterPut hooks.
type BeforeBatchFunc ¶
type BeforeBatchFunc func()
BeforeBatchFunc is a handler for the before Batch hook
type BeforeDeleteFunc ¶
type BeforeDeleteFunc func(datastore.Key) datastore.Key
BeforeDeleteFunc is a handler for the before Delete hook
type BeforeGetFunc ¶
type BeforeGetFunc func(datastore.Key) datastore.Key
BeforeGetFunc is a handler for the before Get hook
type BeforeHasFunc ¶
type BeforeHasFunc func(datastore.Key) datastore.Key
BeforeHasFunc is a handler for the before Has hook
type BeforePutFunc ¶
BeforePutFunc is a handler for the before Put hook
type BeforeQueryFunc ¶
BeforeQueryFunc is a handler for the before Query hook
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore is a wrapper for a datastore that adds optional before and after hooks into it's methods.
func NewDatastore ¶
NewDatastore wraps a datastore.Datastore datastore and adds optional before and after hooks into it's methods.
func (*Datastore) Delete ¶
Delete removes the value for given `key`, it calls OnBeforeDelete and OnAfterDelete hooks.
func (*Datastore) Get ¶
Get retrieves the object `value` named by `key`, it calls OnBeforeGet and OnAfterGet hooks.
func (*Datastore) Put ¶
Put stores the object `value` named by `key`, it calls OnBeforePut and OnAfterPut hooks.
type Option ¶
Option is the hook datastore option type.
func WithAfterBatch ¶
func WithAfterBatch(f AfterBatchFunc) Option
WithAfterBatch configures a hook that is called _after_ Batch. Defaults to noop.
func WithAfterDelete ¶
func WithAfterDelete(f AfterDeleteFunc) Option
WithAfterDelete configures a hook that is called _after_ Delete. Defaults to noop.
func WithAfterGet ¶
func WithAfterGet(f AfterGetFunc) Option
WithAfterGet configures a hook that is called _after_ Get. Defaults to noop.
func WithAfterHas ¶
func WithAfterHas(f AfterHasFunc) Option
WithAfterHas configures a hook that is called _after_ Has. Defaults to noop.
func WithAfterPut ¶
func WithAfterPut(f AfterPutFunc) Option
WithAfterPut configures a hook that is called _after_ Put. Defaults to noop.
func WithAfterQuery ¶
func WithAfterQuery(f AfterQueryFunc) Option
WithAfterQuery configures a hook that is called _after_ Query. Defaults to noop.
func WithBeforeBatch ¶
func WithBeforeBatch(f BeforeBatchFunc) Option
WithBeforeBatch configures a hook that is called _before_ Batch. Defaults to noop.
func WithBeforeDelete ¶
func WithBeforeDelete(f BeforeDeleteFunc) Option
WithBeforeDelete configures a hook that is called _before_ Delete. Defaults to noop.
func WithBeforeGet ¶
func WithBeforeGet(f BeforeGetFunc) Option
WithBeforeGet configures a hook that is called _before_ Get. Defaults to noop.
func WithBeforeHas ¶
func WithBeforeHas(f BeforeHasFunc) Option
WithBeforeHas configures a hook that is called _before_ Has. Defaults to noop.
func WithBeforePut ¶
func WithBeforePut(f BeforePutFunc) Option
WithBeforePut configures a hook that is called _before_ Put. Defaults to noop.
func WithBeforeQuery ¶
func WithBeforeQuery(f BeforeQueryFunc) Option
WithBeforeQuery configures a hook that is called _before_ Query. Defaults to noop.
type Options ¶
type Options struct { BeforeGet BeforeGetFunc AfterGet AfterGetFunc BeforePut BeforePutFunc AfterPut AfterPutFunc BeforeDelete BeforeDeleteFunc AfterDelete AfterDeleteFunc BeforeBatch BeforeBatchFunc AfterBatch AfterBatchFunc BeforeHas BeforeHasFunc AfterHas AfterHasFunc BeforeQuery BeforeQueryFunc AfterQuery AfterQueryFunc }
Options are hook datastore options.