Trait pgx::spi::Query

source ·
pub trait Query {
    type Arguments;
    type Result;

    // Required methods
    fn execute(
        self,
        client: &SpiClient<'_>,
        limit: Option<c_long>,
        arguments: Self::Arguments
    ) -> Self::Result;
    fn open_cursor<'c: 'cc, 'cc>(
        self,
        client: &'cc SpiClient<'c>,
        args: Self::Arguments
    ) -> SpiCursor<'c>;
}
Expand description

A generalized interface to what constitutes a query

Its primary purpose is to abstract away differences between one-off statements and prepared statements, but it can potentially be implemented for other types, provided they can be converted into a query.

Required Associated Types§

Required Methods§

source

fn execute( self, client: &SpiClient<'_>, limit: Option<c_long>, arguments: Self::Arguments ) -> Self::Result

Execute a query given a client and other arguments

source

fn open_cursor<'c: 'cc, 'cc>( self, client: &'cc SpiClient<'c>, args: Self::Arguments ) -> SpiCursor<'c>

Open a cursor for the query

Implementations on Foreign Types§

source§

impl<'a> Query for &'a str

source§

fn execute( self, _client: &SpiClient<'_>, limit: Option<c_long>, arguments: Self::Arguments ) -> Self::Result

Panics

This function will panic if somehow the specified query contains a null byte.

§

type Arguments = Option<Vec<(PgOid, Option<Datum>), Global>>

§

type Result = Result<SpiTupleTable, Error>

source§

fn open_cursor<'c: 'cc, 'cc>( self, _client: &'cc SpiClient<'c>, args: Self::Arguments ) -> SpiCursor<'c>

source§

impl<'a> Query for &'a String

§

type Arguments = Option<Vec<(PgOid, Option<Datum>), Global>>

§

type Result = Result<SpiTupleTable, Error>

source§

fn execute( self, client: &SpiClient<'_>, limit: Option<c_long>, arguments: Self::Arguments ) -> Self::Result

source§

fn open_cursor<'c: 'cc, 'cc>( self, client: &'cc SpiClient<'c>, args: Self::Arguments ) -> SpiCursor<'c>

Implementors§