Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterCommitFunc ¶
AfterCommitFunc is a handler for the after Commit hook
type AfterDeleteFunc ¶
AfterDeleteFunc is a handler for the after Delete hook
type AfterPutFunc ¶
AfterPutFunc is a handler for the after Put hook
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch is a group of Puts and Deletes to be performed (Committed) in one shot.
func NewBatch ¶
NewBatch wraps a datastore.Batch and adds optional before and after hooks into it's methods.
func (*Batch) Commit ¶
Commit submits the batch to the datastore for processing, it calls OnBeforeCommit and OnAfterCommit hooks.
type BeforeCommitFunc ¶
type BeforeCommitFunc func()
BeforeCommitFunc is a handler for the before Commit hook
type BeforeDeleteFunc ¶
type BeforeDeleteFunc func(datastore.Key) datastore.Key
BeforeDeleteFunc is a handler for the before Delete hook
type BeforePutFunc ¶
BeforePutFunc is a handler for the before Put hook
type Option ¶
Option is the batch option type.
func WithAfterCommit ¶
func WithAfterCommit(f AfterCommitFunc) Option
WithAfterCommit configures a hook that is called _after_ Commit. Defaults to noop.
func WithAfterDelete ¶
func WithAfterDelete(f AfterDeleteFunc) Option
WithAfterDelete configures a hook that is called _after_ Delete. Defaults to noop.
func WithAfterPut ¶
func WithAfterPut(f AfterPutFunc) Option
WithAfterPut configures a hook that is called _after_ Put. Defaults to noop.
func WithBeforeCommit ¶
func WithBeforeCommit(f BeforeCommitFunc) Option
WithBeforeCommit configures a hook that is called _before_ Commit. Defaults to noop.
func WithBeforeDelete ¶
func WithBeforeDelete(f BeforeDeleteFunc) Option
WithBeforeDelete configures a hook that is called _before_ Delete. Defaults to noop.
func WithBeforePut ¶
func WithBeforePut(f BeforePutFunc) Option
WithBeforePut configures a hook that is called _before_ Put. Defaults to noop.
type Options ¶
type Options struct { BeforePut BeforePutFunc AfterPut AfterPutFunc BeforeDelete BeforeDeleteFunc AfterDelete AfterDeleteFunc BeforeCommit BeforeCommitFunc AfterCommit AfterCommitFunc }
Options are batch options.