Expand description
SQL column -> Rust field type mapping, plus table-name resolution.
Whole-struct safety lives here: map_columns returns None if any
column’s type isn’t recognized, rejecting the entire model rather
than emitting a partially-wrong struct - a model field is load-bearing
for every query the struct participates in (sqlx::FromRow,
SELECT */INSERT ... RETURNING *), unlike a form-request field
(Phase 2a), which is independently safe to drop.
A real, permanent, documented limitation: Phase 1’s own migration
converter already maps both boolean and integer/bigInteger
Blueprint calls to the identical SQL type INTEGER - by the time this
module reads that output, the boolean/integer distinction is
unrecoverably lost. Every INTEGER column becomes i64, never
bool. This is accepted as a permanent gap (the same shape as
migrations.rs’s own timestamps() precedent: emitted, never fully
converted) rather than reaching back into raw PHP for one field’s
typing, which would reopen the consistency problem schema.rs’s own
doc comment explains.
Structs§
Functions§
- map_
columns - Maps every column of one table into Rust fields -
Noneif any column’s SQL type isn’t recognized (whole-struct safety, see this module’s own doc comment). - resolve_
table_ name - The table name a Laravel model resolves to: an explicit
protected $table = '...'property always wins; otherwise Laravel’s own default (snake_case + pluralize of the class name) - reusingcodegen’s existing helpers directly, no new inference needed.