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)
| 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 | /// |