Struct polodb_core::ClientSession
source · pub struct ClientSession<'a> { /* private fields */ }
Expand description
A PoloDB client session. This struct represents a logical session used for ordering sequential
operations. To create a ClientSession
, call start_session
on a Database
.
Implementations§
source§impl<'a> ClientSession<'a>
impl<'a> ClientSession<'a>
sourcepub fn start_transaction(&mut self, ty: Option<TransactionType>) -> DbResult<()>
pub fn start_transaction(&mut self, ty: Option<TransactionType>) -> DbResult<()>
Manually start a transaction. There are three types of transaction.
None
: Auto transactionSome(Transaction::Write)
: Write transactionSome(Transaction::Read)
: Read transaction
When you pass None
to type parameter. The PoloDB will go into
auto mode. The PoloDB will go into read mode firstly, once the users
execute write operations(insert/update/delete), the DB will turn into
write mode.