Documentation
¶
Overview ¶
Package builder provides a fluent API for constructing events.
Index ¶
- type EventBuilder
- func AgentExecuted(agentID, action string) *EventBuilder
- func EmailSent(emailID, recipient string) *EventBuilder
- func JobCompleted(jobID string, duration float64) *EventBuilder
- func JobEnqueued(jobID, jobType string) *EventBuilder
- func JobFailed(jobID string, err error, attempts int) *EventBuilder
- func JobStarted(jobID, workerID string) *EventBuilder
- func NewEvent(eventType bus.EventType) *EventBuilder
- func TestSuiteCompleted(suiteID string, passed, failed, skipped int) *EventBuilder
- func WebhookTriggered(webhookID, url string) *EventBuilder
- func WorkflowCompleted(workflowID string, duration float64) *EventBuilder
- func WorkflowFailed(workflowID string, err error) *EventBuilder
- func WorkflowStarted(workflowID string) *EventBuilder
- func (b *EventBuilder) Build() bus.Event
- func (b *EventBuilder) WithData(key string, value interface{}) *EventBuilder
- func (b *EventBuilder) WithDataMap(data map[string]interface{}) *EventBuilder
- func (b *EventBuilder) WithID(id string) *EventBuilder
- func (b *EventBuilder) WithMetadata(key, value string) *EventBuilder
- func (b *EventBuilder) WithMetadataMap(metadata map[string]string) *EventBuilder
- func (b *EventBuilder) WithSource(source string) *EventBuilder
- func (b *EventBuilder) WithTimestamp(t time.Time) *EventBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBuilder ¶
type EventBuilder struct {
// contains filtered or unexported fields
}
EventBuilder provides a fluent interface for building events.
func AgentExecuted ¶
func AgentExecuted(agentID, action string) *EventBuilder
AgentExecuted creates a builder for an agent executed event.
func EmailSent ¶
func EmailSent(emailID, recipient string) *EventBuilder
EmailSent creates a builder for an email sent event.
func JobCompleted ¶
func JobCompleted(jobID string, duration float64) *EventBuilder
JobCompleted creates a builder for a job completed event.
func JobEnqueued ¶
func JobEnqueued(jobID, jobType string) *EventBuilder
JobEnqueued creates a builder for a job enqueued event.
func JobFailed ¶
func JobFailed(jobID string, err error, attempts int) *EventBuilder
JobFailed creates a builder for a job failed event.
func JobStarted ¶
func JobStarted(jobID, workerID string) *EventBuilder
JobStarted creates a builder for a job started event.
func NewEvent ¶
func NewEvent(eventType bus.EventType) *EventBuilder
NewEvent creates a new EventBuilder with the given event type.
func TestSuiteCompleted ¶
func TestSuiteCompleted(suiteID string, passed, failed, skipped int) *EventBuilder
TestSuiteCompleted creates a builder for a test suite completed event.
func WebhookTriggered ¶
func WebhookTriggered(webhookID, url string) *EventBuilder
WebhookTriggered creates a builder for a webhook triggered event.
func WorkflowCompleted ¶
func WorkflowCompleted(workflowID string, duration float64) *EventBuilder
WorkflowCompleted creates a builder for a workflow completed event.
func WorkflowFailed ¶
func WorkflowFailed(workflowID string, err error) *EventBuilder
WorkflowFailed creates a builder for a workflow failed event.
func WorkflowStarted ¶
func WorkflowStarted(workflowID string) *EventBuilder
WorkflowStarted creates a builder for a workflow started event.
func (*EventBuilder) Build ¶
func (b *EventBuilder) Build() bus.Event
Build returns the constructed event.
func (*EventBuilder) WithData ¶
func (b *EventBuilder) WithData(key string, value interface{}) *EventBuilder
WithData adds a key-value pair to the event data.
func (*EventBuilder) WithDataMap ¶
func (b *EventBuilder) WithDataMap(data map[string]interface{}) *EventBuilder
WithDataMap merges the given map into the event data.
func (*EventBuilder) WithID ¶
func (b *EventBuilder) WithID(id string) *EventBuilder
WithID sets a custom ID for the event.
func (*EventBuilder) WithMetadata ¶
func (b *EventBuilder) WithMetadata(key, value string) *EventBuilder
WithMetadata adds a key-value pair to the event metadata.
func (*EventBuilder) WithMetadataMap ¶
func (b *EventBuilder) WithMetadataMap(metadata map[string]string) *EventBuilder
WithMetadataMap merges the given map into the event metadata.
func (*EventBuilder) WithSource ¶
func (b *EventBuilder) WithSource(source string) *EventBuilder
WithSource sets the source of the event.
func (*EventBuilder) WithTimestamp ¶
func (b *EventBuilder) WithTimestamp(t time.Time) *EventBuilder
WithTimestamp sets a custom timestamp for the event.