pub mod mock; #[cfg(not(test))] pub mod pgrx; use serde_json::Value; /// An abstraction over database execution to allow for isolated unit testing /// without a live Postgres SPI connection. pub trait DatabaseExecutor: Send + Sync { /// Executes a query expecting a single JSONB return, representing rows. fn query(&self, sql: &str, args: Option<&[Value]>) -> Result; /// Executes an operation (INSERT, UPDATE, DELETE, or pg_notify) that does not return rows. fn execute(&self, sql: &str, args: Option<&[Value]>) -> Result<(), String>; /// Returns the current authenticated user's ID fn auth_user_id(&self) -> Result; /// Returns the current transaction timestamp fn timestamp(&self) -> Result; #[cfg(test)] fn get_queries(&self) -> Vec; #[cfg(test)] fn reset_mocks(&self); }