domain

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package domain holds Hallmark's business aggregates. The audit event is immutable: it carries who did what to which resource, when, plus optional structured changes and metadata.

Index

Constants

View Source
const ResourceTypeAuditEvent resource.Type = "audit-events"

ResourceTypeAuditEvent is the JSON:API type for /api/audit-events.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditEvent

type AuditEvent interface {
	resource.Resource
	Timestamp() time.Time
	RealmID() string
	ActorID() string
	ActorType() string
	ResourceType() string
	ResourceID() string
	Action() string
	Summary() string
	Changes() map[string]any
	Metadata() map[string]any
	IP() string
	RequestID() string
}

AuditEvent is one immutable record in the stream: who did what to which resource, when, with optional structured changes and metadata. Events are append-only — there is no mutation surface on the aggregate.

func NewAuditEvent

func NewAuditEvent(action string, opts ...AuditEventOption) AuditEvent

NewAuditEvent builds an audit-event aggregate. action is the only mandatory field; id and timestamp default at the storage layer when unset.

type AuditEventOption

type AuditEventOption func(*auditEvent)

func WithAuditEventActor

func WithAuditEventActor(id, actorType string) AuditEventOption

func WithAuditEventChanges

func WithAuditEventChanges(c map[string]any) AuditEventOption

func WithAuditEventID

func WithAuditEventID(id string) AuditEventOption

func WithAuditEventIP

func WithAuditEventIP(ip string) AuditEventOption

func WithAuditEventMetadata

func WithAuditEventMetadata(m map[string]any) AuditEventOption

func WithAuditEventRealmID

func WithAuditEventRealmID(id string) AuditEventOption

func WithAuditEventRequestID

func WithAuditEventRequestID(id string) AuditEventOption

func WithAuditEventResource

func WithAuditEventResource(resourceType, resourceID string) AuditEventOption

func WithAuditEventSummary

func WithAuditEventSummary(s string) AuditEventOption

func WithAuditEventTimestamp

func WithAuditEventTimestamp(t time.Time) AuditEventOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL