Skip to content

Commit cd5537f

Browse files
committed
Rename get_transaction_isolation to transaction_isolation
1 parent a12fe90 commit cd5537f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,15 @@ impl Connection {
11261126
self.batch_execute(level.to_set_query())
11271127
}
11281128

1129-
/// Returns the isolation level which will be used for future transactions.
1129+
/// # Deprecated
1130+
///
1131+
/// Use `transaction_isolation` instead.
11301132
pub fn get_transaction_isolation(&self) -> Result<IsolationLevel> {
1133+
self.transaction_isolation()
1134+
}
1135+
1136+
/// Returns the isolation level which will be used for future transactions.
1137+
pub fn transaction_isolation(&self) -> Result<IsolationLevel> {
11311138
let mut conn = self.conn.borrow_mut();
11321139
check_desync!(conn);
11331140
let result = try!(conn.quick_query("SHOW TRANSACTION ISOLATION LEVEL"));

tests/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -950,13 +950,13 @@ fn url_encoded_password() {
950950
#[test]
951951
fn test_transaction_isolation_level() {
952952
let conn = or_panic!(Connection::connect("postgres://postgres@localhost", &SslMode::None));
953-
assert_eq!(IsolationLevel::ReadCommitted, or_panic!(conn.get_transaction_isolation()));
953+
assert_eq!(IsolationLevel::ReadCommitted, or_panic!(conn.transaction_isolation()));
954954
or_panic!(conn.set_transaction_isolation(IsolationLevel::ReadUncommitted));
955-
assert_eq!(IsolationLevel::ReadUncommitted, or_panic!(conn.get_transaction_isolation()));
955+
assert_eq!(IsolationLevel::ReadUncommitted, or_panic!(conn.transaction_isolation()));
956956
or_panic!(conn.set_transaction_isolation(IsolationLevel::RepeatableRead));
957-
assert_eq!(IsolationLevel::RepeatableRead, or_panic!(conn.get_transaction_isolation()));
957+
assert_eq!(IsolationLevel::RepeatableRead, or_panic!(conn.transaction_isolation()));
958958
or_panic!(conn.set_transaction_isolation(IsolationLevel::Serializable));
959-
assert_eq!(IsolationLevel::Serializable, or_panic!(conn.get_transaction_isolation()));
959+
assert_eq!(IsolationLevel::Serializable, or_panic!(conn.transaction_isolation()));
960960
or_panic!(conn.set_transaction_isolation(IsolationLevel::ReadCommitted));
961-
assert_eq!(IsolationLevel::ReadCommitted, or_panic!(conn.get_transaction_isolation()));
961+
assert_eq!(IsolationLevel::ReadCommitted, or_panic!(conn.transaction_isolation()));
962962
}

0 commit comments

Comments
 (0)