Skip to main content
pub trait KineticaPoolExt 
    // Required methods
    fn execute_sql(
        &self,
        sql: &str,
    ) -> impl Future<Output = Result<u64, SqlxError>> + Send;
fn table_exists(
        &self,
        table_name: &str,
    ) -> impl Future<Output = Result<bool, SqlxError>> + Send;
fn count_rows(
        &self,
        table_name: &str,
        condition: Option<&str>,
    ) -> impl Future<Output = Result<i64, SqlxError>> + Send;
fn fetch_page(
        &self,
        sql: &str,
        offset: i64,
        limit: i64,
    ) -> impl Future<Output = Result<(Vec<PgRow>, i64), SqlxError>> + Send;
fn fetch_all_pages<F>(
        &self,
        sql: &str,
        page_size: i64,
        callback: F,
    ) -> impl Future<Output = Result<SqlxPaginationStats, SqlxError>> + Send
       where F: FnMut(Vec<PgRow>, u64) -> Result<bool, SqlxError> + Send;
fn fetch_all_paginated(
        &self,
        sql: &str,
        page_size: i64,
    ) -> impl Future<Output = Result<Vec<PgRow>, SqlxError>> + Send;

Extension trait for PgPool with Kinetica-specific helpers.

Required Methods

Source

fn execute_sql( &self, sql: &str, ) -> impl Future<Output = Result<u64, SqlxError>> + Send

Execute a raw SQL statement and return the number of rows affected.

Source

fn table_exists( &self, table_name: &str, ) -> impl Future<Output = Result<bool, SqlxError>> + Send

Check if a table exists.

Source

fn count_rows( &self, table_name: &str, condition: Option<&str>, ) -> impl Future<Output = Result<i64, SqlxError>> + Send

Get the count of rows in a table.

Source

fn fetch_page( &self, sql: &str, offset: i64, limit: i64, ) -> impl Future<Output = Result<(Vec<PgRow>, i64), SqlxError>> + Send

Execute a query with pagination (LIMIT/OFFSET).

Returns rows for the specified page along with the total count.

  • sql - The base SQL query (without LIMIT/OFFSET)
  • offset - Number of rows to skip
  • limit - Maximum number of rows to return
Source

fn fetch_all_pages<F>( &self, sql: &str, page_size: i64, callback: F, ) -> impl Future<Output = Result<SqlxPaginationStats, SqlxError>> + Send
where F: FnMut(Vec<PgRow>, u64) -> Result<bool, SqlxError> + Send,

Execute a query and process all results page by page with a callback.

This is memory-efficient as it only loads one page at a time.

  • sql - The base SQL query (without LIMIT/OFFSET)
  • page_size - Number of rows per page
  • callback - Function called for each page; return false to stop early
Source

fn fetch_all_paginated( &self, sql: &str, page_size: i64, ) -> impl Future<Output = Result<Vec<PgRow>, SqlxError>> + Send

Fetch all rows from a query, automatically handling pagination.

Warning: This loads all results into memory. For very large result sets, use fetch_all_pages to process results in batches.

  • sql - The base SQL query (without LIMIT/OFFSET)
  • page_size - Number of rows to fetch per page

Dyn Compatibility

This trait is not dyn compatible.

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

Implementors