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§
Required Methods§
Sourcefn query_one(
&mut self,
operation: &'static str,
statement: &str,
params: MetadataParameters<'_>,
) -> Result<Self::Row, PgMetaError>
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.
Sourcefn query_optional(
&mut self,
operation: &'static str,
statement: &str,
params: MetadataParameters<'_>,
) -> Result<Option<Self::Row>, PgMetaError>
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.
Sourcefn query_many(
&mut self,
operation: &'static str,
statement: &str,
params: MetadataParameters<'_>,
) -> Result<Vec<Self::Row>, PgMetaError>
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.
Sourcefn execute_command(
&mut self,
operation: &'static str,
statement: &str,
params: MetadataParameters<'_>,
) -> Result<u64, PgMetaError>
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.