Skip to main content

Module types

Module types 

Source
Expand description

Data-contract system for external dependencies.

When a project references objects it does not own (e.g. tables created by an upstream ingestion pipeline), mz-deploy needs to know their column schemas so it can type-check views that depend on them. This module manages that contract through the types.lock file.

§Lock File Lifecycle

  1. Capture — Column schemas are queried from the live environment and written to types.lock.
  2. Compile — The lock file is loaded and its schemas are used to resolve external dependency columns during compilation.
  3. Validate — During incremental typechecking, external dependency schemas are provided to the validation backend when dirty objects reference them.

§Compiler Integration

Incremental runtime typechecking is owned by crate::project::compiler::typecheck. That subsystem persists per-object validation artifacts for consumers such as explain and the LSP.

This module owns:

  • the types.lock contract format
  • shared type/schema utilities such as type_hash

§Key Types

  • Types — In-memory representation of a types.lock file: a versioned map from fully-qualified object names to column schemas, plus optional object-level comments from COMMENT ON in the source database.
  • ColumnType — A single column’s type name, nullability, and optional COMMENT ON COLUMN description.

Structs§

ColumnLock 🔒
ColumnType
A single column’s type name, nullability, and optional comment in a data contract.
ObjectLock 🔒
Types
In-memory representation of a types.lock file.
TypesLock 🔒
TOML serialization format for types.lock

Enums§

ObjectKind
The kind of database object recorded in a types.lock entry.
TypesError
Errors that can occur when reading, writing, or parsing types.lock files.

Constants§

BUILD_DIR 🔒
Directory name for mz-deploy build artifacts.

Functions§

escape_toml_string 🔒
Escape a string for use as a TOML basic string value.
load_types_lock 🔒
Load the types.lock file from the specified directory. Returns an error if the file doesn’t exist or cannot be parsed.
write_toml 🔒
Hand-format a TypesLock as TOML with per-kind sections and inline columns.