Arc.Descriptor (cratis_arc v0.1.0)

Copy Markdown View Source

Compile-time metadata of a command or a read model, exposed as __arc__/0 on the artifact.

Discovery reads descriptors from compiled modules; there is no runtime reflection over source.

Summary

Functions

The conventional route of a command, built from route_prefix, the namespace segments after segments_to_skip, and the kebab-cased command name.

The fully qualified name of a query: the container module plus the PascalCase function name.

The conventional route of a query.

Resolves the module, feature and slice of an artifact from its namespace segments, with the same rules the C# generator uses: fewer than three segments fill the deepest parts first.

Types

t()

@type t() :: %Arc.Descriptor{
  authorization: term(),
  doc: term(),
  fields: term(),
  key: term(),
  kind: term(),
  model: term(),
  model_types: term(),
  module: term(),
  name: term(),
  namespace: term(),
  queries: term(),
  response: term()
}

Functions

command_route(descriptor, opts \\ [])

@spec command_route(t(), keyword()) :: String.t()

The conventional route of a command, built from route_prefix, the namespace segments after segments_to_skip, and the kebab-cased command name.

query_name(descriptor, query)

@spec query_name(t(), Arc.Descriptor.Query.t()) :: String.t()

The fully qualified name of a query: the container module plus the PascalCase function name.

query_route(descriptor, query, opts \\ [])

@spec query_route(t(), Arc.Descriptor.Query.t(), keyword()) :: String.t()

The conventional route of a query.

slice_location(descriptor, segments_to_skip)

@spec slice_location(t(), integer()) :: {String.t(), String.t(), String.t()}

Resolves the module, feature and slice of an artifact from its namespace segments, with the same rules the C# generator uses: fewer than three segments fill the deepest parts first.