Caravela.Schema.Domain (Caravela v0.5.1)

Copy Markdown View Source

A whole domain: the top-level IR produced by compilation.

Summary

Functions

Lookup an entity by its DSL name.

Does the domain declare a hook for action on entity?

Does the domain declare a permission for action on entity?

Is the domain multi-tenant (row-level scoped by tenant_id)?

Explicit API version declared via version "v1" in the DSL. Returns the raw string (e.g. "v1") or nil when no version was declared.

Camelized version segment usable as a module name suffix ("v1""V1"). Returns nil when no version is declared.

Types

t()

@type t() :: %Caravela.Schema.Domain{
  entities: [Caravela.Schema.Entity.t()],
  hooks: [Caravela.Schema.Hook.t()],
  module: module(),
  opts: keyword(),
  permissions: [Caravela.Schema.Permission.t()],
  relations: [Caravela.Schema.Relation.t()]
}

Functions

fetch_entity(domain, name)

Lookup an entity by its DSL name.

has_hook?(domain, action, entity)

Does the domain declare a hook for action on entity?

has_permission?(domain, action, entity)

Does the domain declare a permission for action on entity?

multi_tenant?(domain)

Is the domain multi-tenant (row-level scoped by tenant_id)?

version(domain)

Explicit API version declared via version "v1" in the DSL. Returns the raw string (e.g. "v1") or nil when no version was declared.

version_segment(domain)

Camelized version segment usable as a module name suffix ("v1""V1"). Returns nil when no version is declared.