Go SDK · Event shape

The Go type:

type Event struct {
    ID             string         // UUID v4; auto-generated when empty
    TenantID       string         // optional; set when partitioning events by your end-customer
    OccurredAt     time.Time      // auto-populated when zero
    Actor          Actor          // who caused the event
    Action         string         // dotted verb, e.g. "user.lock"
    Target         Target         // what was acted on
    Metadata       map[string]any // freeform context
    Origin         Origin         // IP, user-agent, request ID (auto-populated by middleware)
    Result         Result         // outcome
    Change         *Change        // before/after for mutations
    IdempotencyKey string         // optional dedup key
}

type Actor  struct { Type, ID, DisplayName, Email string }
type Target struct { Type, ID string }
type Result struct { Status string; Code int; Message any } // Status: "ok" | "error" | "denied"
type Origin struct { IP, UserAgent, RequestID string }

Populate Change for mutation events via the e.Diff(before, after, ...) helper.