Documentation ¶
Index ¶
Constants ¶
const ( BeforeSave Kind = "beforeSave" AfterSave = "afterSave" BeforeDelete = "beforeDelete" AfterDelete = "afterDelete" )
The four kind of hooks provided by Skygear.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Func ¶
Func defines the interface of a function that can be hooked.
The supplied record is fully fetched for all four kind of hooks.
type Kind ¶
type Kind string
Kind defines when a hook should be executed on mutation of skydb.Record.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a registry of hooks by record type.
It provides method to execute hooks but is not responsible to execute registered hook. The responsibility is currently handled by handler.
In future the registry should hook itself into Record lifecycle and manage hooks executions itself. Such hooking point does not exist at the moment.
func (*Registry) ExecuteHooks ¶
func (r *Registry) ExecuteHooks(ctx context.Context, kind Kind, record *skydb.Record, oldRecord *skydb.Record) skyerr.Error
ExecuteHooks executes registered hooks for the type of supplied record to be executed at the specific kind of moment.
If one of the hooks returns an error, it halts execution of other hooks and return sthat error untouched.