rqlite_client/response/mapping/execute.rs
1//! `execute`
2
3use std::collections::HashMap;
4
5use crate::Value;
6
7use super::timed::Timed;
8
9/// `Execute` result
10///
11/// ```json
12/// {
13/// "results": [
14/// {
15/// "last_insert_id": 1,
16/// "rows_affected": 1,
17/// "time": 0.00886
18/// }
19/// ],
20/// "time": 0.0152
21/// }
22/// ```
23///
24/// See <https://rqlite.io/docs/api/api/#writing-data> or <https://rqlite.io/docs/api/bulk-api/#updates>
25///
26#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
27pub struct Execute {
28 /// last inserted id
29 pub last_insert_id: u64,
30 /// optional rows of result
31 #[serde(skip_serializing_if = "Option::is_none")]
32 pub rows: Option<Vec<HashMap<String, Value>>>,
33 /// number of affected rows
34 pub rows_affected: usize,
35 /// optional timing info
36 #[serde(skip_serializing_if = "Option::is_none")]
37 pub time: Option<f64>,
38}
39
40impl Timed for Execute {
41 fn time(&self) -> Option<f64> {
42 self.time
43 }
44}