[−][src]Struct automaat_processor_sql_query::SqlQuery
The processor configuration.
Fields
statement: String
The SQL statement to execute. This MUST start with "SELECT ...".
url: Url
The URL of the database server.
Use URLs such as postgres://postgres:mypassword@127.0.0.1/my_database
Trait Implementations
impl Clone for SqlQuery
[src]
fn clone(&self) -> SqlQuery
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<SqlQuery> for SqlQuery
[src]
impl Eq for SqlQuery
[src]
impl Debug for SqlQuery
[src]
impl<'a> Processor<'a> for SqlQuery
[src]
const NAME: &'static str
[src]
type Error = Error
If a processor fails its intended purpose, the returned error is turned into a string, and shown in the automaat-web-client
application. Read more
type Output = String
The processor can return any (successful) output it wants, as long as that type implements the [std::fmt::Display
] trait. Read more
fn validate(&self) -> Result<(), Self::Error>
[src]
Validate that the provided statement
is valid, and the url
has a
supported scheme.
Errors
If the statement contains invalid syntax, the Error::Syntax
error
variant is returned.
If multiple statements are detected, the Error::MultipleStatements
error variant is returned.
If the statement does not start with "SELECT", the
Error::StatementType
error variant is returned.
If the url
scheme does not match postgres
, the Error::Scheme
error variant is returned.
fn run(&self, _context: &Context) -> Result<Option<Self::Output>, Self::Error>
[src]
Run the provided statement
against a database and return the values as
an array of JSON objects.
Output
If no records are found, None
is returned.
If one or more records are found, a JSON array of objects is returned. Each object contains the column names as its keys, and the record values as its values.
Errors
If a database error occurs, the relevant database error type (such as
Error::Postgres
) is returned.
If an unsupported data type is returned, the Error::ReturnType
error
is returned.
If anything happens during serialization, the Error::Serde
error is
returned.
impl<'de> Deserialize<'de> for SqlQuery
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for SqlQuery
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Erased for T
impl<T> Same<T> for T
type Output = T
Should always be Self