Liking cljdoc? Tell your friends :D

boundary.calendar.core.event

Event type registry and pure helper functions.

Provides the defevent macro for declaring event type definitions as data, an in-process registry backed by an atom, and pure helper functions for working with EventData maps.

FC/IS rule: no I/O here. All side effects live in the shell layer.

Event type registry and pure helper functions.

Provides the `defevent` macro for declaring event type definitions as data,
an in-process registry backed by an atom, and pure helper functions
for working with EventData maps.

FC/IS rule: no I/O here. All side effects live in the shell layer.
raw docstring

all-day?clj

(all-day? event)

Return true if the event spans at least 24 hours and starts at midnight UTC.

Args: event - EventData map

Returns boolean.

Return true if the event spans at least 24 hours and starts at midnight UTC.

Args:
  event - EventData map

Returns boolean.
sourceraw docstring

clear-registry!clj

(clear-registry!)

Reset the registry to an empty map.

Use in tests to avoid inter-test pollution.

Reset the registry to an empty map.

Use in tests to avoid inter-test pollution.
sourceraw docstring

defeventcljmacro

(defevent sym definition-map)

Define and register an event type.

The body is a map literal that must satisfy EventDef schema. After macro expansion the definition is automatically registered in the in-process registry so it is available via get-event-type.

Example:

(defevent appointment-event {:id :appointment :label "Appointment" :schema [:map [:patient-id :uuid] [:room :string]]})

The var appointment-event is bound to the definition map. The event type is registered under :appointment.

Define and register an event type.

The body is a map literal that must satisfy EventDef schema.
After macro expansion the definition is automatically registered in the
in-process registry so it is available via `get-event-type`.

Example:

  (defevent appointment-event
    {:id    :appointment
     :label "Appointment"
     :schema [:map
              [:patient-id :uuid]
              [:room       :string]]})

The var `appointment-event` is bound to the definition map.
The event type is registered under :appointment.
sourceraw docstring

durationclj

(duration event)

Return the java.time.Duration between an event's :start and :end.

Args: event - EventData map with :start and :end Instants

Returns java.time.Duration (may be zero or negative for malformed events).

Return the java.time.Duration between an event's :start and :end.

Args:
  event - EventData map with :start and :end Instants

Returns java.time.Duration (may be zero or negative for malformed events).
sourceraw docstring

explain-eventclj

(explain-event event)

Returns human-readable validation errors for an event map.

Delegates to boundary.calendar.schema/explain-event.

Returns human-readable validation errors for an event map.

Delegates to boundary.calendar.schema/explain-event.
sourceraw docstring

get-event-typeclj

(get-event-type id)

Look up an event type definition by id.

Returns the definition map or nil if not found.

Look up an event type definition by id.

Returns the definition map or nil if not found.
sourceraw docstring

list-event-typesclj

(list-event-types)

Return a vector of all registered event type ids.

Return a vector of all registered event type ids.
sourceraw docstring

register-event-type!clj

(register-event-type! definition)

Register an event type definition in the in-process registry.

Args: definition - EventDef map

Returns the definition map.

Register an event type definition in the in-process registry.

Args:
  definition - EventDef map

Returns the definition map.
sourceraw docstring

valid-event?clj

(valid-event? event)

Returns true if the given map satisfies EventData schema.

Delegates to boundary.calendar.schema/valid-event?.

Returns true if the given map satisfies EventData schema.

Delegates to boundary.calendar.schema/valid-event?.
sourceraw docstring

within-range?clj

(within-range? event range-start range-end)

Return true if the event overlaps with [range-start, range-end).

Uses half-open interval: event start < range-end AND event end > range-start.

Args: event - EventData map with :start and :end Instants range-start - java.time.Instant range-end - java.time.Instant

Returns boolean.

Return true if the event overlaps with [range-start, range-end).

Uses half-open interval: event start < range-end AND event end > range-start.

Args:
  event       - EventData map with :start and :end Instants
  range-start - java.time.Instant
  range-end   - java.time.Instant

Returns boolean.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close