mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Move models and other shareable code to pkg/domain and add own go.mod * Update all references to use pkg/domain paths * Fix generated file * Ensure pkg/domain tests are run by just tests * Use new models path in connector templates * Copy local pkg/domain in dockerfile * Ensure pkg/domain is subject to go generate
35 lines
845 B
Go
35 lines
845 B
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type OutboxEventStatus string
|
|
|
|
const (
|
|
OUTBOX_STATUS_PENDING OutboxEventStatus = "pending"
|
|
OUTBOX_STATUS_FAILED OutboxEventStatus = "failed"
|
|
OUTBOX_STATUS_PROCESSED OutboxEventStatus = "processed"
|
|
)
|
|
|
|
const MaxOutboxRetries = 5
|
|
|
|
type OutboxEvent struct {
|
|
// Primary key
|
|
ID EventID `json:"id"`
|
|
|
|
// Mandatory fields
|
|
EventType string `json:"eventType"`
|
|
EntityID string `json:"entityId"`
|
|
Payload json.RawMessage `json:"payload"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
Status OutboxEventStatus `json:"status"`
|
|
|
|
// Optional fields
|
|
ConnectorID *ConnectorID `json:"connectorId,omitempty"`
|
|
RetryCount int `json:"retryCount"`
|
|
LastRetryAt *time.Time `json:"lastRetryAt,omitempty"`
|
|
Error *string `json:"error,omitempty"`
|
|
}
|