Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hook ¶
type Hook struct {
Name string `json:"name,omitempty"`
Trigger HookTrigger `json:"trigger,omitempty"`
Action HookAction `json:"action,omitempty"`
ProcessType HookProcessType `json:"process_type,omitempty"`
Type HookType `json:"type,omitempty"`
}
func FilterHooksByType ¶
func GetHooksByTriggerOnAndModel ¶
func GetHooksByTriggerOnAndModel(allHooks []Hook, on HookTriggerOn, model string) []Hook
func (*Hook) Execute ¶
func (s *Hook) Execute(data HookPayload) error
func (*Hook) Run ¶
func (s *Hook) Run(data HookPayload) error
type HookAction ¶
type HookAction string
const ( HookActionWebhook HookAction = "Webhook" HookActionTriggerFunction HookAction = "Internal-Function" )
type HookConditions ¶
type HookLogsModel ¶
type HookLogsModel struct {
ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id,omitempty"`
Details Hook `gorm:"column:details;type:jsonb" json:"details,omitempty"`
ExecutedAt *time.Time `gorm:"column:executed_on;default:CURRENT_TIMESTAMP" json:"executed_at,omitempty"`
}
func (*HookLogsModel) Get ¶
func (t *HookLogsModel) Get(db *gorm.DB) ([]*HookLogsModel, error)
func (*HookLogsModel) GetByID ¶
func (t *HookLogsModel) GetByID(db *gorm.DB, id int64) (*HookLogsModel, error)
func (*HookLogsModel) TableName ¶
func (t *HookLogsModel) TableName() string
type HookPayload ¶
type HookPayload struct {
TriggerAction []HookTriggerOn `json:"trigger_action,omitempty"`
TriggerModels []string `json:"trigger_models,omitempty"`
OutputData OutputData `json:"output_data,omitempty"`
Input HookConditions `json:"input,omitempty"`
}
type HookProcessType ¶
type HookProcessType string
const ( HookProcessSync HookProcessType = "Sync" HookProcessAsync HookProcessType = "Async" )
type HookQuery ¶
type HookQuery struct {
Sql string `json:"sql,omitempty"`
Args []interface{} `json:"args,omitempty"`
}
type HookTrigger ¶
type HookTrigger struct {
On []HookTriggerOn `json:"on,omitempty"`
Models []string `json:"model,omitempty"`
Func func(HookPayload) error `json:"-"`
Webhooks []WebHook `json:"webhooks,omitempty"`
}
type HookTriggerOn ¶
type HookTriggerOn string
const ( HookTriggerOnStartTransaction HookTriggerOn = "Start-Transaction" HookTriggerOnCommit HookTriggerOn = "Commit-Transaction" HookTriggerOnRollback HookTriggerOn = "Rollback-Transaction" HookTriggerOnCreate HookTriggerOn = "Create" HookTriggerOnUpdate HookTriggerOn = "Update" HookTriggerOnDelete HookTriggerOn = "Delete" )
type OutputData ¶
Click to show internal directories.
Click to hide internal directories.