Documentation / @zerotal/orm / index / ModelInspector
Variable: ModelInspector
constModelInspector:object
Defined in: packages/orm/src/schema/ModelInspector.ts:79
Reads model class metadata from columnRegistry (populated when a model's @table
decorator drains its queued @column registrations at class-definition time) and
returns a structured schema description for each registered model.
Prototype-chain walking: columns declared on a parent class are inherited by child classes, matching normal TypeScript class semantics.
Used by migrate:generate to compare model intent against the live DB.
Type Declaration
load()
load(
pattern,cwd?):Promise<void>
Dynamically import all files matching pattern (relative to cwd).
Importing a model file runs its @table decorator, which registers the class's
columns into columnRegistry at definition time — so all() can enumerate them.
Parameters
pattern
string
cwd?
string = ...
Returns
Promise<void>
all()
all():
ModelSchema[]
Return a ModelSchema for every class registered in columnRegistry
that has a non-empty static table property.
Skips anonymous classes, the BaseModel base class, and any class that
hasn't set static table. Walks the prototype chain so that inherited
columns are included automatically.
Returns
fromClass()
fromClass(
ctor):ModelSchema|null
Read the schema for a single model class.
Returns null if the class has no static table or no @column() fields
anywhere in its prototype chain.
Parameters
ctor
Function
Returns
ModelSchema | null