INNER CODE UNIT · Rust
get_try_cast_fn_sql
lanterndata/lantern · lantern_cli/src/embeddings/mod.rs:69
pub fn get_try_cast_fn_sql(schema: &str) -> String {
format!(
"
CREATE OR REPLACE FUNCTION {schema}.ldb_try_cast(_in text, INOUT _out ANYELEMENT)
LANGUAGE plpgsql AS
$func$
BEGIN
EXECUTE format('SELECT %L::%s', $1, pg_typeof(_out))
INTO _out;
EXCEPTION WHEN others THEN
END
$func$;",
schema = quote_ident(schema)
)
}
// Helper function to calculate progress using total and processed row count
fn calculate_progress(total: i64, processed: usize) -> u8 {