Skip to main content

NamedQuery

Trait NamedQuery 

Source
pub trait NamedQuery<C> {
    // Required methods
    fn name(&self) -> &'static str;
    fn query_from_json(
        &self,
        args: &[Value],
        context: &C,
    ) -> Result<(AnyQuery, Vec<Value>), String>;
}
Expand description

A named query whose arguments come as JSON, as the server gets them, whatever its types: for a list of an app’s queries, such as a test that checks them against the TS definitions.

Required Methods§

Source

fn name(&self) -> &'static str

Its name in the TS query registry.

Source

fn query_from_json( &self, args: &[Value], context: &C, ) -> Result<(AnyQuery, Vec<Value>), String>

The query for args (none, or one JSON value) read as the definition’s argument type, as context sees it, with the arguments as this side sends them.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A, C, R, T> NamedQuery<C> for QueryDefinition<A, C, R, T>
where A: Serialize + DeserializeOwned + Send + Sync + 'static, C: 'static, R: 'static, T: 'static,