gleamunison/codebase_index

Types

A datalog datom for the codebase index: entity is a stable per-def int, value is always a string (hashes, names, kinds) so q-val joins work.

pub type Datom {
  Datom(entity: Int, attr: String, value: String)
}

Constructors

  • Datom(entity: Int, attr: String, value: String)

Values

pub fn datoms_of(
  defs: List(#(String, elab_types.SurfaceDef)),
) -> List(Datom)

The index schema: one entity per definition, carrying name/hash/kind, plus one def/dep datom per in-corpus name the body references.

pub fn eval_index_source(
  script: String,
) -> Result(String, String)

Evaluate an index script under the native datalog engine. The engine sources are prepended (same path the datalog CLI uses).

pub fn index_source(
  defs: List(#(String, elab_types.SurfaceDef)),
) -> String

The generated index script: engine-agnostic prelude (bindings extraction helper) followed by one db-assert chain building db.

pub fn kind_of(def: elab_types.SurfaceDef) -> String

The definition kind as the index reports it.

pub fn ref_hex(
  name: String,
  def: elab_types.SurfaceDef,
) -> String

The ref hex for a definition: the genesis ref for builtins, the name-hash for surface defs. Single source of ref identity for the index, MCP search, and graph tools.

✨ Search Document