# `Decree.Store.EventData`
[🔗](https://github.com/sparkle-space/decree/blob/v0.1.0/lib/decree/store/event_data.ex#L1)

EventData contains the data for a single event before being persisted to storage

`tags` are stored with the event, in the same transaction. A repeated tag is stored
once. A tag that is not a string Postgres can hold refuses the append with
`{:error, :invalid_tag}`, and one over 512 bytes with `{:error, :tag_too_long}`.

`required_tag_kinds` are the kinds this event may not be stored without. They are checked
and not stored. An event lacking one refuses the append with
`{:error, :missing_required_tag}`, and a list that is not kinds with
`{:error, :invalid_required_tag_kinds}`. A kind is carried by a tag equal to it, or by a tag
`<kind>:<value>` with a value, so `"email:"` does not carry `"email"`.

# `t`

```elixir
@type t() :: %Decree.Store.EventData{
  causation_id: String.t() | nil,
  correlation_id: String.t() | nil,
  data: term(),
  event_id: uuid() | nil,
  event_type: String.t(),
  metadata: term() | nil,
  required_tag_kinds: list(),
  tags: [String.t()]
}
```

# `uuid`

```elixir
@type uuid() :: String.t()
```

# `fetch`

# `get_and_update`

# `max_tag_bytes`

The most bytes a tag can have.

# `valid_tag?`

```elixir
@spec valid_tag?(term()) :: boolean()
```

Whether a value is a string Postgres can hold as a tag: a binary of valid UTF-8 with no
NUL byte. Its length is `max_tag_bytes/0`'s question.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
