Skip to main content

validate_scalar_sql

Function validate_scalar_sql 

Source
pub fn validate_scalar_sql(sql: &str) -> Result<(), ValidationError>
Expand description

Validate a scalar SQL string: runs the dry-run and checks the result projects exactly one column. Used by query_scalar!.

Does not require a struct registration — scalars project a single column of a primitive type without mapping to a struct. However, tables referenced by the SQL still need to be registered via derive(Table) #[hyperdb(register)] for compile-time validation to work; unregistered tables produce a TablesNotRegistered diagnostic.

§Errors

Returns a ValidationError if the SQL is invalid, references an unregistered table, or the result schema does not have exactly one column.