1017e2fffb
Closes SUR-53 When creating a new context for subqueries or statement clauses, we used to have to clone any variables/values, and freeze the context, so that it could be used across threads and async boundaries. Now with the new executor pattern for parallel queries, we can pass references instead, improving performance by removing unnecessary cloning of values.
15 lines
445 B
Rust
15 lines
445 B
Rust
use crate::ctx::Context;
|
|
use crate::dbs::Options;
|
|
use crate::dbs::Transaction;
|
|
use crate::kvs::Datastore;
|
|
use futures::lock::Mutex;
|
|
use std::sync::Arc;
|
|
|
|
pub async fn mock<'a>() -> (Context<'a>, Options, Transaction) {
|
|
let ctx = Context::default();
|
|
let opt = Options::default();
|
|
let kvs = Datastore::new("memory").await.unwrap();
|
|
let txn = kvs.transaction(true, false).await.unwrap();
|
|
let txn = Arc::new(Mutex::new(txn));
|
|
(ctx, opt, txn)
|
|
}
|