pub struct DataSource { /* private fields */ }
Expand description
Data sources.
Implementations§
Source§impl DataSource
impl DataSource
Sourcepub fn try_new(
protocol: &'static str,
config: &Table,
) -> Result<DataSource, Error>
pub fn try_new( protocol: &'static str, config: &Table, ) -> Result<DataSource, Error>
Constructs a new instance with the protocol and configuration, returning an error if it fails.
Currently, we have built-in support for the following protocols:
arrow
http
mssql
mysql
postgres
sqlite
Sourcepub fn source_type(&self) -> &str
pub fn source_type(&self) -> &str
Returns the data source type.
Trait Implementations§
Source§impl Connector for DataSource
impl Connector for DataSource
Source§fn try_new_data_source(config: &Table) -> Result<DataSource, Error>
fn try_new_data_source(config: &Table) -> Result<DataSource, Error>
Constructs a new data source with the configuration,
returning an error if it fails.
Source§async fn execute(
&self,
query: &str,
params: Option<&Map>,
) -> Result<Option<u64>, Error>
async fn execute( &self, query: &str, params: Option<&Map>, ) -> Result<Option<u64>, Error>
Executes the query and returns the total number of rows affected.
Source§async fn query(
&self,
query: &str,
params: Option<&Map>,
) -> Result<Vec<Record>, Error>
async fn query( &self, query: &str, params: Option<&Map>, ) -> Result<Vec<Record>, Error>
Executes the query and parses it as
Vec<Record>
.Source§async fn query_one(
&self,
query: &str,
params: Option<&Map>,
) -> Result<Option<Record>, Error>
async fn query_one( &self, query: &str, params: Option<&Map>, ) -> Result<Option<Record>, Error>
Executes the query and parses it as a
Record
.Source§async fn query_as<T: DeserializeOwned>(
&self,
query: &str,
params: Option<&Map>,
) -> Result<Vec<T>, Error>
async fn query_as<T: DeserializeOwned>( &self, query: &str, params: Option<&Map>, ) -> Result<Vec<T>, Error>
Executes the query and parses it as
Vec<T>
.Source§async fn query_one_as<T: DeserializeOwned>(
&self,
query: &str,
params: Option<&Map>,
) -> Result<Option<T>, Error>
async fn query_one_as<T: DeserializeOwned>( &self, query: &str, params: Option<&Map>, ) -> Result<Option<T>, Error>
Executes the query and parses it as an instance of type
T
.Auto Trait Implementations§
impl !Freeze for DataSource
impl !RefUnwindSafe for DataSource
impl Send for DataSource
impl Sync for DataSource
impl Unpin for DataSource
impl !UnwindSafe for DataSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more