[][src]Struct automaat_processor_sql_query::SqlQuery

pub struct SqlQuery {
    pub statement: String,
    pub url: Url,
}

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 Eq for SqlQuery[src]

impl PartialEq<SqlQuery> for SqlQuery[src]

impl Clone for SqlQuery[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for SqlQuery[src]

impl<'a> Processor<'a> for SqlQuery[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]

impl Serialize for SqlQuery[src]

Auto Trait Implementations

impl Send for SqlQuery

impl Sync for SqlQuery

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T> Same<T> for T

type Output = T

Should always be Self