Trait SimpleQueryHandler

Source
pub trait SimpleQueryHandler: Send + Sync {
    // Required method
    fn do_query<'a, 'life0, 'life1, 'life2, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        query: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<Vec<Response<'a>>>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn on_query<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        query: Query,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

handler for processing simple query.

Required Methods§

Source

fn do_query<'a, 'life0, 'life1, 'life2, 'async_trait, C>( &'life0 self, client: &'life1 mut C, query: &'life2 str, ) -> Pin<Box<dyn Future<Output = PgWireResult<Vec<Response<'a>>>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provide your query implementation using the incoming query string.

Provided Methods§

Source

fn on_query<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, query: Query, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executed on Query request arrived. This is how postgres respond to simple query. The default implementation calls do_query with the incoming query string.

This handle checks empty query by default, if the query string is empty or ;, it returns EmptyQueryResponse and does not call self.do_query.

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§