MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / first

Method first

sdk-rust/src/result.rs:172–178  ·  view source on GitHub ↗

Get the first row as the given type Convenience method for queries that return a single row. # Type Parameters `T` - Type to deserialize into (must implement Deserialize) # Examples ```no_run use serde::Deserialize; # use graphlite_sdk::GraphLite; #[derive(Deserialize)] struct Count { count: i64 } # fn main() -> Result<(), graphlite_sdk::Error> { # let db = GraphLite::open("./mydb")?; # let

(&self)

Source from the content-addressed store, hash-verified

170 /// # }
171 /// ```
172 pub fn first<T: DeserializeOwned>(&self) -> Result<T> {
173 let row = self
174 .get_row(0)
175 .ok_or_else(|| Error::NotFound("No rows returned".to_string()))?;
176
177 self.deserialize_row(row)
178 }
179
180 /// Get a single value from the first row and first column
181 ///

Calls 2

get_rowMethod · 0.45
deserialize_rowMethod · 0.45