pub struct GenerateBuilder { /* private fields */ }Expand description
Builds one GenerateRequest and runs it. The only validation performed
here is request shape (e.g. RunMode::Generate needs an output path);
anything about the model itself — a missing config, a compile error —
surfaces from Generate::run as a structured GenerateError.
Implementations§
Source§impl GenerateBuilder
impl GenerateBuilder
Sourcepub fn input(self, path: impl Into<PathBuf>) -> Self
pub fn input(self, path: impl Into<PathBuf>) -> Self
A source dump to profile into a base model. Profiling and inference run
automatically; combine with a kind: overrides .config() to patch
the profiled base.
Sourcepub fn config(self, path: impl Into<PathBuf>) -> Self
pub fn config(self, path: impl Into<PathBuf>) -> Self
The kind: model (or, once a base model is available, kind: overrides) YAML document to generate from.
Sourcepub fn output(self, path: impl Into<PathBuf>) -> Self
pub fn output(self, path: impl Into<PathBuf>) -> Self
The path rendered SQL is published to atomically after successful
generation. Required under RunMode::Generate; optional under
Check/DryRun, which never write SQL regardless.
Sourcepub fn emit(self, path: impl Into<PathBuf>) -> Self
pub fn emit(self, path: impl Into<PathBuf>) -> Self
The path the resolved, self-contained model is published to atomically
(--emit-config). Emitting fires alongside whatever mode runs.
Sourcepub fn input_dialect(self, dialect: SqlDialect) -> Self
pub fn input_dialect(self, dialect: SqlDialect) -> Self
Force the dialect the source dump (.input()) is parsed as, instead of
auto-detecting it.
Sourcepub fn profile_sample(self, sample: usize) -> Self
pub fn profile_sample(self, sample: usize) -> Self
Per-column retained sample size used while profiling .input().
Sourcepub fn output_dialect(self, dialect: SqlDialect) -> Self
pub fn output_dialect(self, dialect: SqlDialect) -> Self
The SQL dialect to render for, overriding the model’s own output.dialect
and captured source dialect. Choosing a dialect that differs from the
model’s source dialect renders every type across dialects (reporting lossy
conversions); leaving it unset resolves the dialect from the model
(output.dialect, else the source/input dialect, else MySQL).
Sourcepub fn mssql_production_style(self, production_style: bool) -> Self
pub fn mssql_production_style(self, production_style: bool) -> Self
Render MSSQL output in “production style” — see
RenderOptions::mssql_production_style. No effect outside
SqlDialect::Mssql.
Sourcepub fn mssql_go(self, interval: u64) -> Self
pub fn mssql_go(self, interval: u64) -> Self
Emit a GO batch separator every interval INSERT batches instead
of after every batch — see RenderOptions::mssql_go. No effect
outside SqlDialect::Mssql.
Sourcepub fn table_scale(
self,
table: impl Into<String>,
factor: f64,
) -> Result<Self, GenerateError>
pub fn table_scale( self, table: impl Into<String>, factor: f64, ) -> Result<Self, GenerateError>
A per-table row-count scale factor (--table-scale). Rejects a
non-finite or negative factor.
Sourcepub fn compile(self, compile: CompileOptions) -> Self
pub fn compile(self, compile: CompileOptions) -> Self
Replace the full CompileOptions (row-count controls, table
selection) in one call.
Sourcepub fn verify(self, verify: bool) -> Self
pub fn verify(self, verify: bool) -> Self
Whether to verify the generated SQL against the compiled plan and
publish atomically only if the audit passes. Requires a filesystem SQL
destination (.output()); a stdout destination is a usage error.
Sourcepub fn strict(self, strict: bool) -> Self
pub fn strict(self, strict: bool) -> Self
Treat every warning as fatal and publish no requested output when one is discovered.
Sourcepub fn profile_depth(self, depth: ProfileDepth) -> Self
pub fn profile_depth(self, depth: ProfileDepth) -> Self
The profiling depth for .input() (defaults to the profiler’s full
depth when unset).
Sourcepub fn mode(self, mode: RunMode) -> Self
pub fn mode(self, mode: RunMode) -> Self
Run in Check, DryRun, or (the default) full Generate mode.
Sourcepub fn run(self) -> Result<GenerateReport, GenerateError>
pub fn run(self) -> Result<GenerateReport, GenerateError>
Build the request and run it end to end.
Trait Implementations§
Source§impl Clone for GenerateBuilder
impl Clone for GenerateBuilder
Source§fn clone(&self) -> GenerateBuilder
fn clone(&self) -> GenerateBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenerateBuilder
impl Debug for GenerateBuilder
Source§impl Default for GenerateBuilder
impl Default for GenerateBuilder
Source§fn default() -> GenerateBuilder
fn default() -> GenerateBuilder
Auto Trait Implementations§
impl Freeze for GenerateBuilder
impl RefUnwindSafe for GenerateBuilder
impl Send for GenerateBuilder
impl Sync for GenerateBuilder
impl Unpin for GenerateBuilder
impl UnsafeUnpin for GenerateBuilder
impl UnwindSafe for GenerateBuilder
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more