Skip to main content

MetadataTransaction

Trait MetadataTransaction 

Source
pub trait MetadataTransaction {
    type Row;

    // Required methods
    fn query_one(
        &mut self,
        operation: &'static str,
        statement: &str,
        params: MetadataParameters<'_>,
    ) -> Result<Self::Row, PgMetaError>;
    fn query_optional(
        &mut self,
        operation: &'static str,
        statement: &str,
        params: MetadataParameters<'_>,
    ) -> Result<Option<Self::Row>, PgMetaError>;
    fn query_many(
        &mut self,
        operation: &'static str,
        statement: &str,
        params: MetadataParameters<'_>,
    ) -> Result<Vec<Self::Row>, PgMetaError>;
    fn execute_command(
        &mut self,
        operation: &'static str,
        statement: &str,
        params: MetadataParameters<'_>,
    ) -> Result<u64, PgMetaError>;
}
Expand description

Transaction-scoped metadata execution interface.

Required Associated Types§

Source

type Row

Row representation returned by the concrete executor.

Required Methods§

Source

fn query_one( &mut self, operation: &'static str, statement: &str, params: MetadataParameters<'_>, ) -> Result<Self::Row, PgMetaError>

Runs a query expected to return exactly one row.

§Errors

Returns an error when PostgreSQL/libpq rejects the query or the result shape does not match the executor contract.

Source

fn query_optional( &mut self, operation: &'static str, statement: &str, params: MetadataParameters<'_>, ) -> Result<Option<Self::Row>, PgMetaError>

Runs a query expected to return zero or one row.

§Errors

Returns an error when PostgreSQL/libpq rejects the query or the result shape contains more than one row.

Source

fn query_many( &mut self, operation: &'static str, statement: &str, params: MetadataParameters<'_>, ) -> Result<Vec<Self::Row>, PgMetaError>

Runs a query that can return many rows.

§Errors

Returns an error when PostgreSQL/libpq rejects the query or parameters.

Source

fn execute_command( &mut self, operation: &'static str, statement: &str, params: MetadataParameters<'_>, ) -> Result<u64, PgMetaError>

Executes a metadata write command.

§Errors

Returns an error when PostgreSQL/libpq rejects the command or parameters.

Implementors§