Skip to content

Commit

Permalink
feat: support transaction. (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun authored Mar 1, 2024
1 parent e0da4f8 commit 34aa05b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
use std::collections::BTreeMap;

use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
pub struct ServerInfo {
pub id: String,
pub start_time: String,
}
#[derive(Deserialize, Serialize, Debug, Default, Clone)]
pub struct SessionState {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -26,6 +30,13 @@ pub struct SessionState {
pub role: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub secondary_roles: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub txn_state: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_server_info: Option<ServerInfo>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub last_query_ids: Vec<String>,
}

impl SessionState {
Expand Down Expand Up @@ -117,6 +128,9 @@ mod test {
settings: Some(BTreeMap::new()),
role: None,
secondary_roles: None,
txn_state: None,
last_server_info: None,
last_query_ids: vec![],
}))
.with_pagination(Some(PaginationConfig {
wait_time_secs: Some(1),
Expand Down

0 comments on commit 34aa05b

Please sign in to comment.