91 lines
2.8 KiB
Go
91 lines
2.8 KiB
Go
package imkafka
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type Actor struct {
|
|
Type string `json:"type,omitempty"`
|
|
ID string `json:"id,omitempty"`
|
|
DisplayName string `json:"display_name,omitempty"`
|
|
}
|
|
|
|
type Envelope struct {
|
|
EventID string `json:"event_id"`
|
|
TraceID string `json:"trace_id,omitempty"`
|
|
TenantCode string `json:"tenant_code,omitempty"`
|
|
SourceService string `json:"source_service,omitempty"`
|
|
TargetService string `json:"target_service,omitempty"`
|
|
EventType string `json:"event_type"`
|
|
BizType string `json:"biz_type,omitempty"`
|
|
BizID string `json:"biz_id,omitempty"`
|
|
IdempotencyKey string `json:"idempotency_key,omitempty"`
|
|
Version int64 `json:"version,omitempty"`
|
|
OccurredAt time.Time `json:"occurred_at"`
|
|
Actor *Actor `json:"actor,omitempty"`
|
|
Payload json.RawMessage `json:"payload,omitempty"`
|
|
ParentEventID string `json:"parent_event_id,omitempty"`
|
|
}
|
|
|
|
type CommandResult struct {
|
|
EventID string `json:"event_id"`
|
|
TraceID string `json:"trace_id,omitempty"`
|
|
TenantCode string `json:"tenant_code,omitempty"`
|
|
CommandID string `json:"command_id"`
|
|
CommandEventID string `json:"command_event_id"`
|
|
Status string `json:"status"`
|
|
Reason string `json:"reason,omitempty"`
|
|
Message string `json:"message,omitempty"`
|
|
Result json.RawMessage `json:"result,omitempty"`
|
|
OccurredAt time.Time `json:"occurred_at"`
|
|
}
|
|
|
|
type AdminCommandInput struct {
|
|
TenantID int64
|
|
TenantCode string
|
|
EventType string
|
|
BizType string
|
|
BizID string
|
|
IdempotencyKey string
|
|
Version int64
|
|
Actor *Actor
|
|
Payload map[string]any
|
|
CreatedBy int64
|
|
}
|
|
|
|
type ConfigEventInput struct {
|
|
TenantID int64
|
|
TenantCode string
|
|
EventType string
|
|
BizID string
|
|
Group string
|
|
Keys []string
|
|
Actor *Actor
|
|
CreatedBy int64
|
|
}
|
|
|
|
type EventInput struct {
|
|
Topic string
|
|
TenantCode string
|
|
TargetService string
|
|
EventType string
|
|
BizType string
|
|
BizID string
|
|
IdempotencyKey string
|
|
Version int64
|
|
Actor *Actor
|
|
Payload map[string]any
|
|
CreatedBy int64
|
|
}
|
|
|
|
type AdminCommandModel struct {
|
|
CommandID string `json:"commandId" dc:"命令ID"`
|
|
EventID string `json:"eventId" dc:"Kafka事件ID"`
|
|
Status string `json:"status" dc:"状态"`
|
|
TenantID int64 `json:"tenantId" dc:"租户ID"`
|
|
TenantCode string `json:"tenantCode" dc:"租户编码"`
|
|
EventType string `json:"eventType" dc:"事件类型"`
|
|
IdempotencyKey string `json:"idempotencyKey" dc:"幂等键"`
|
|
}
|