surrealpatch/lib/src/sql/value/first.rs
Tobie Morgan Hitchcock d4566ff6ea Improve performance with query path analysis
Instead of creating a new Vec<_> for every embedded path part, we now use a reference when calling get/set/del on a value’s data. This means we aren’t creating and copying the Vec items each and every time we traverse down a path.
2022-02-22 19:05:58 +00:00

17 lines
340 B
Rust

use crate::dbs::Options;
use crate::dbs::Runtime;
use crate::dbs::Transaction;
use crate::err::Error;
use crate::sql::part::Part;
use crate::sql::value::Value;
impl Value {
pub async fn first(
&self,
ctx: &Runtime,
opt: &Options,
txn: &Transaction,
) -> Result<Self, Error> {
self.get(ctx, opt, txn, &[Part::First]).await
}
}