AuditLog.Actor (AuditLog v0.1.0)

Copy Markdown View Source

A durable snapshot of the person or service responsible for an event.

Actor types and identifiers are application-owned codes stored as text. A label is an optional display snapshot, such as the email address an operator would have recognised when the event occurred. No field is a foreign key to a mutable application record.

Summary

Functions

Builds an actor from an application-owned type and identifier.

Types

t()

@type t() :: %AuditLog.Actor{
  id: String.t(),
  label: String.t() | nil,
  type: String.t()
}

Functions

new!(type, id, opts \\ [])

@spec new!(String.Chars.t(), String.Chars.t(), keyword()) :: t()

Builds an actor from an application-owned type and identifier.

type, id, and the optional :label must implement String.Chars. Values are converted to strings and trimmed. The required type and ID must not be blank.

Example

AuditLog.Actor.new!("user", 42, label: "ada@example.com")