pub trait Source {
// Required methods
fn open(
&mut self,
connection: &Map<String, Value>,
read_only: bool,
) -> Result<()>;
fn execute(
&mut self,
sql: &str,
row_limit: Option<u64>,
out: &mut dyn ResultSink,
) -> Result<()>;
// Provided methods
fn connection_fields(&self) -> Vec<ConnectionField> { ... }
fn identifier_quote(&self) -> Option<&'static str> { ... }
fn validate_connection(
&self,
_connection: &Map<String, Value>,
) -> Vec<String> { ... }
fn check(&mut self, _sql: &str) -> Result<()> { ... }
fn load(&mut self, _name: &str, _data: &mut ResultSet<'_>) -> Result<Loaded> { ... }
fn close(&mut self) { ... }
}Required Methods§
Provided Methods§
fn connection_fields(&self) -> Vec<ConnectionField>
Sourcefn identifier_quote(&self) -> Option<&'static str>
fn identifier_quote(&self) -> Option<&'static str>
The character the database quotes identifiers with, reported in describe: " for
most SQL databases, a backtick for Databricks and MySQL. Core doubles it inside a name.
Sourcefn validate_connection(&self, _connection: &Map<String, Value>) -> Vec<String>
fn validate_connection(&self, _connection: &Map<String, Value>) -> Vec<String>
Rules the declared Source::connection_fields can’t express (two keys that can’t go
together, a value’s form), each a sentence naming the field, never its value. Static:
no network. Run by validate_connection and before open.
A value set through an unset env_var() arrives as null.
Sourcefn check(&mut self, _sql: &str) -> Result<()>
fn check(&mut self, _sql: &str) -> Result<()>
Verify without executing. Only called when the plugin advertises check.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".