Skip to main content

GenerateBuilder

Struct GenerateBuilder 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn explain(self, explain: bool) -> Self

Whether to build the --explain inference report.

Source

pub fn input_dialect(self, dialect: SqlDialect) -> Self

Force the dialect the source dump (.input()) is parsed as, instead of auto-detecting it.

Source

pub fn profile_sample(self, sample: usize) -> Self

Per-column retained sample size used while profiling .input().

Source

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).

Source

pub fn seed(self, seed: u64) -> Self

The run’s root seed, overriding the model’s own seed:.

Source

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.

Source

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.

Source

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.

Source

pub fn compile(self, compile: CompileOptions) -> Self

Replace the full CompileOptions (row-count controls, table selection) in one call.

Source

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.

Source

pub fn strict(self, strict: bool) -> Self

Treat every warning as fatal and publish no requested output when one is discovered.

Source

pub fn profile_depth(self, depth: ProfileDepth) -> Self

The profiling depth for .input() (defaults to the profiler’s full depth when unset).

Source

pub fn mode(self, mode: RunMode) -> Self

Run in Check, DryRun, or (the default) full Generate mode.

Source

pub fn run(self) -> Result<GenerateReport, GenerateError>

Build the request and run it end to end.

Trait Implementations§

Source§

impl Clone for GenerateBuilder

Source§

fn clone(&self) -> GenerateBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenerateBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GenerateBuilder

Source§

fn default() -> GenerateBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V