immutable tri-state

This commit is contained in:
2026-08-03 12:03:03 -04:00
parent c071a959f7
commit c5e103c867
8 changed files with 149 additions and 8 deletions

View File

@ -150,4 +150,26 @@ impl DatabaseExecutor for SpiExecutor {
})
})
}
fn punc_external(&self) -> Result<bool, String> {
self.transact(|| {
Spi::connect(|client| {
let mut tup_table = client
.select(
"SELECT COALESCE(current_setting('punc.external', true), 'false')::boolean",
None,
&[],
)
.map_err(|e| format!("SPI Select Error: {}", e))?;
let row = tup_table
.next()
.ok_or("No setting returned from context".to_string())?;
let is_external: Option<bool> = row.get(1).map_err(|e| e.to_string())?;
Ok(is_external.unwrap_or(false))
})
})
}
}