Query

Trait Query 

Source
pub trait Query:
    Sized
    + Send
    + Sync {
    type Args: Serialize + Clone + Send + Sync;
    type Result: DeserializeOwned + Send + Sync;

    // Required methods
    fn template_name() -> &'static str;
    fn args(&self) -> &Self::Args;
    fn from_result(result: Self::Result) -> Self;
}
Expand description

Trait for defining parameterized queries

Queries allow executing specific operations against the test database.

Required Associated Types§

Source

type Args: Serialize + Clone + Send + Sync

The type of arguments passed to the query

Source

type Result: DeserializeOwned + Send + Sync

The type of result returned by the query

Required Methods§

Source

fn template_name() -> &'static str

The name of this query template

Source

fn args(&self) -> &Self::Args

Get the arguments for this query

Source

fn from_result(result: Self::Result) -> Self

Create an instance from the query result

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§