# bookclerk_library::entities::domain_events

SeaORM entity for the durable `domain_events` outbox.

| Item | Kind | Summary |
| --- | --- | --- |
| [`Model`](#model) | struct | Row shape for this table (`DeriveEntityModel`). |
| [`ColumnIter`](#columniter) | struct | An iterator over the variants of [Column] |
| [`Entity`](#entity) | struct | Generated by sea-orm-macros |
| [`PrimaryKeyIter`](#primarykeyiter) | struct | An iterator over the variants of [PrimaryKey] |
| [`ActiveModel`](#activemodel) | struct | Generated by sea-orm-macros |
| [`RelationIter`](#relationiter) | struct | An iterator over the variants of [Relation] |
| [`Column`](#column) | enum | Generated by sea-orm-macros |
| [`PrimaryKey`](#primarykey) | enum | Generated by sea-orm-macros |
| [`Relation`](#relation) | enum | Declared SeaORM relations (deliveries are queried by `event_id`). |

## Structs

### Model

```rust
pub struct Model {
    pub id: String,
    pub event_type: String,
    pub schema_version: i64,
    pub occurred_at: String,
    pub account_id: String,
    pub source: String,
    pub correlation_id: String,
    pub causation_id: String,
    pub dedup_key: String,
    pub payload: String,
    pub ordering_key: String,
    pub dispatch_state: String,
    pub created_at: String,
    pub wake_pending: i64,
    pub wake_lease_owner: Option<String>,
    pub wake_lease_expires_at: Option<String>,
    pub wake_cursor_at: String,
    pub wake_cursor_id: String,
    pub dispatch_snapshot_json: String,
    pub queue_name: String,
    pub content_type: String,
    pub deliver_after: String,
}
```

Row shape for this table (`DeriveEntityModel`).

**Fields**

- `id`: Stable event id (UUID).
- `event_type`: Event type (`book_acquired`, …).
- `schema_version`: Payload schema version.
- `occurred_at`: RFC 3339 occurrence time.
- `account_id`: Tenant / account id, when known.
- `source`: Producer plugin id (`audible`, …); empty when unknown.
- `correlation_id`: Trace correlation id.
- `causation_id`: Causing event or job id.
- `dedup_key`: Producer idempotency key unique with `(account_id, source, event_type)`.
- `payload`: Bounded JSON payload (never media bytes).
- `ordering_key`: Producer FIFO key copied onto each delivery.
- `dispatch_state`: `pending` until deliveries are created, then `dispatched`.
- `created_at`: RFC 3339 insert time.
- `wake_pending`: `1` until matching suspended deliveries have been woken (or none exist).
- `wake_lease_owner`: Worker that currently holds the wake-slice lease.
- `wake_lease_expires_at`: RFC 3339 wake-slice lease expiry.
- `wake_cursor_at`: `(created_at, id)` cursor for the next wake delivery page.
- `wake_cursor_id`: Delivery id cursor paired with [`Self::wake_cursor_at`](#model).
- `dispatch_snapshot_json`: Frozen JSON array of plugin ids for paged dispatch receipts.
- `queue_name`: Queue this row belongs to (`core.events` for the domain-event bus).
- `content_type`: Body encoding of `payload` (`json`, `text`, or `bytes` as base64).
- `deliver_after`: RFC 3339 earliest delivery time for delayed queue messages; empty = now.

#### Model::into_ex

```rust
pub fn into_ex(self) -> Self
```

Generated by sea-orm-macros

Implements: `Clone`, `Debug`, `Eq`, `From<Model>`, `FromQueryResult`, `IntoActiveModel<ActiveModel>`, `ModelTrait`, `PartialEq`, `TryFrom<ActiveModel>`, `TryIntoModel<Model>`

### ColumnIter

```rust
pub struct ColumnIter {
    /* private fields */
}
```

An iterator over the variants of [Column](#column)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

### Entity

```rust
pub struct Entity;
```

Generated by sea-orm-macros

Implements: `Clone`, `Copy`, `Debug`, `Default`, `EntityName`, `EntityTrait`, `Iden`, `IdenStatic`

### PrimaryKeyIter

```rust
pub struct PrimaryKeyIter {
    /* private fields */
}
```

An iterator over the variants of [PrimaryKey](#primarykey)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

### ActiveModel

```rust
pub struct ActiveModel {
    pub id: ActiveValue<String>,
    pub event_type: ActiveValue<String>,
    pub schema_version: ActiveValue<i64>,
    pub occurred_at: ActiveValue<String>,
    pub account_id: ActiveValue<String>,
    pub source: ActiveValue<String>,
    pub correlation_id: ActiveValue<String>,
    pub causation_id: ActiveValue<String>,
    pub dedup_key: ActiveValue<String>,
    pub payload: ActiveValue<String>,
    pub ordering_key: ActiveValue<String>,
    pub dispatch_state: ActiveValue<String>,
    pub created_at: ActiveValue<String>,
    pub wake_pending: ActiveValue<i64>,
    pub wake_lease_owner: ActiveValue<Option<String>>,
    pub wake_lease_expires_at: ActiveValue<Option<String>>,
    pub wake_cursor_at: ActiveValue<String>,
    pub wake_cursor_id: ActiveValue<String>,
    pub dispatch_snapshot_json: ActiveValue<String>,
    pub queue_name: ActiveValue<String>,
    pub content_type: ActiveValue<String>,
    pub deliver_after: ActiveValue<String>,
}
```

Generated by sea-orm-macros

**Fields**

- `id`: Generated by sea-orm-macros
- `event_type`: Generated by sea-orm-macros
- `schema_version`: Generated by sea-orm-macros
- `occurred_at`: Generated by sea-orm-macros
- `account_id`: Generated by sea-orm-macros
- `source`: Generated by sea-orm-macros
- `correlation_id`: Generated by sea-orm-macros
- `causation_id`: Generated by sea-orm-macros
- `dedup_key`: Generated by sea-orm-macros
- `payload`: Generated by sea-orm-macros
- `ordering_key`: Generated by sea-orm-macros
- `dispatch_state`: Generated by sea-orm-macros
- `created_at`: Generated by sea-orm-macros
- `wake_pending`: Generated by sea-orm-macros
- `wake_lease_owner`: Generated by sea-orm-macros
- `wake_lease_expires_at`: Generated by sea-orm-macros
- `wake_cursor_at`: Generated by sea-orm-macros
- `wake_cursor_id`: Generated by sea-orm-macros
- `dispatch_snapshot_json`: Generated by sea-orm-macros
- `queue_name`: Generated by sea-orm-macros
- `content_type`: Generated by sea-orm-macros
- `deliver_after`: Generated by sea-orm-macros

Implements: `ActiveModelBehavior`, `ActiveModelTrait`, `Clone`, `Debug`, `Default`, `From<Model>`, `IntoActiveModel<ActiveModel>`, `PartialEq`, `TryFrom<ActiveModel>`, `TryIntoModel<Model>`

### RelationIter

```rust
pub struct RelationIter {
    /* private fields */
}
```

An iterator over the variants of [Relation](#relation)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

## Enums

### Column

```rust
pub enum Column {
    Id,
    EventType,
    SchemaVersion,
    OccurredAt,
    AccountId,
    Source,
    CorrelationId,
    CausationId,
    DedupKey,
    Payload,
    OrderingKey,
    DispatchState,
    CreatedAt,
    WakePending,
    WakeLeaseOwner,
    WakeLeaseExpiresAt,
    WakeCursorAt,
    WakeCursorId,
    DispatchSnapshotJson,
    QueueName,
    ContentType,
    DeliverAfter,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros
- `EventType`: Generated by sea-orm-macros
- `SchemaVersion`: Generated by sea-orm-macros
- `OccurredAt`: Generated by sea-orm-macros
- `AccountId`: Generated by sea-orm-macros
- `Source`: Generated by sea-orm-macros
- `CorrelationId`: Generated by sea-orm-macros
- `CausationId`: Generated by sea-orm-macros
- `DedupKey`: Generated by sea-orm-macros
- `Payload`: Generated by sea-orm-macros
- `OrderingKey`: Generated by sea-orm-macros
- `DispatchState`: Generated by sea-orm-macros
- `CreatedAt`: Generated by sea-orm-macros
- `WakePending`: Generated by sea-orm-macros
- `WakeLeaseOwner`: Generated by sea-orm-macros
- `WakeLeaseExpiresAt`: Generated by sea-orm-macros
- `WakeCursorAt`: Generated by sea-orm-macros
- `WakeCursorId`: Generated by sea-orm-macros
- `DispatchSnapshotJson`: Generated by sea-orm-macros
- `QueueName`: Generated by sea-orm-macros
- `ContentType`: Generated by sea-orm-macros
- `DeliverAfter`: Generated by sea-orm-macros

Implements: `Clone`, `ColumnTrait`, `Copy`, `Debug`, `FromStr`, `Iden`, `IdenStatic`, `IntoEnumIterator`

### PrimaryKey

```rust
pub enum PrimaryKey {
    Id,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros

Implements: `Clone`, `Copy`, `Debug`, `Iden`, `IdenStatic`, `IntoEnumIterator`, `PrimaryKeyToColumn`, `PrimaryKeyTrait`

### Relation

```rust
pub enum Relation {}
```

Declared SeaORM relations (deliveries are queried by `event_id`).

Implements: `Clone`, `Copy`, `Debug`, `IntoEnumIterator`, `RelationTrait`
