Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IsolationLevel pub #292

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions edgedb-tokio/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ static IDLE_TIMEOUT_RULE: Lazy<RetryRule> = Lazy::new(|| RetryRule {
});


/// Transaction isolation level
///
/// Only single isolation level is supported for now
#[derive(Debug, Clone)]
pub enum IsolationLevel {
/// Serializable isolation level
Serializable,
}

/// Specific condition for retrying queries
///
/// This is used for fine-grained control for retrying queries and transactions
Expand All @@ -45,7 +36,6 @@ pub enum RetryCondition {
/// [`with_transaction_options`](crate::Client::with_transaction_options).
#[derive(Debug, Clone)]
pub struct TransactionOptions {
isolation: IsolationLevel,
read_only: bool,
deferrable: bool,
}
Expand All @@ -72,19 +62,13 @@ pub(crate) struct RetryRule {
impl Default for TransactionOptions {
fn default() -> TransactionOptions {
TransactionOptions {
isolation: IsolationLevel::Serializable,
read_only: false,
deferrable: false,
}
}
}

impl TransactionOptions {
/// Set isolation level for the transaction
pub fn isolation(mut self, isolation: IsolationLevel) -> Self {
self.isolation = isolation;
self
}
/// Set whether transaction is read-only
pub fn read_only(mut self, read_only: bool) -> Self {
self.read_only = read_only;
Expand Down