diff --git a/pgdog-plugin/src/c_api.rs b/pgdog-plugin/src/c_api.rs index 4dff46d..4182257 100644 --- a/pgdog-plugin/src/c_api.rs +++ b/pgdog-plugin/src/c_api.rs @@ -11,7 +11,6 @@ pub extern "C" fn pgdog_row_new(num_columns: c_int) -> Row { std::mem::align_of::(), ) .unwrap(); - Row { num_columns, diff --git a/pgdog-plugin/src/plugin.rs b/pgdog-plugin/src/plugin.rs index dc467a2..a3b538c 100644 --- a/pgdog-plugin/src/plugin.rs +++ b/pgdog-plugin/src/plugin.rs @@ -42,7 +42,9 @@ impl<'a> Plugin<'a> { /// Route query. pub fn route(&self, query: Query) -> Option { - self.route.as_ref().map(|route| unsafe { route(query.into()) }) + self.route + .as_ref() + .map(|route| unsafe { route(query.into()) }) } /// Perform initialization. diff --git a/pgdog/src/backend/databases.rs b/pgdog/src/backend/databases.rs index c452afb..2948a1b 100644 --- a/pgdog/src/backend/databases.rs +++ b/pgdog/src/backend/databases.rs @@ -83,7 +83,6 @@ pub struct Databases { databases: HashMap, } - impl Databases { /// Get a cluster for the user/database pair if it's configured. pub fn cluster(&self, user: impl ToUser) -> Result { diff --git a/pgdog/src/backend/pool/stats.rs b/pgdog/src/backend/pool/stats.rs index e69de29..8b13789 100644 --- a/pgdog/src/backend/pool/stats.rs +++ b/pgdog/src/backend/pool/stats.rs @@ -0,0 +1 @@ + diff --git a/pgdog/src/frontend/router/parser/select.rs b/pgdog/src/frontend/router/parser/select.rs index e69de29..8b13789 100644 --- a/pgdog/src/frontend/router/parser/select.rs +++ b/pgdog/src/frontend/router/parser/select.rs @@ -0,0 +1 @@ + diff --git a/pgdog/src/net/messages/parse.rs b/pgdog/src/net/messages/parse.rs index 6ce9df2..c766764 100644 --- a/pgdog/src/net/messages/parse.rs +++ b/pgdog/src/net/messages/parse.rs @@ -23,9 +23,7 @@ impl FromBytes for Parse { let name = c_string_buf(&mut bytes); let query = c_string_buf(&mut bytes); let params = bytes.get_i16() as usize; - let data_types = (0..params) - .map(|_| bytes.get_i32()) - .collect::>(); + let data_types = (0..params).map(|_| bytes.get_i32()).collect::>(); Ok(Self { name, diff --git a/pgdog/src/net/parameter.rs b/pgdog/src/net/parameter.rs index d9d3914..b123bb5 100644 --- a/pgdog/src/net/parameter.rs +++ b/pgdog/src/net/parameter.rs @@ -23,7 +23,8 @@ impl Parameters { /// Find a paramaeter by name. pub fn get(&self, name: &str) -> Option<&str> { self.params - .iter().find(|p| p.name == name) + .iter() + .find(|p| p.name == name) .map(|p| p.value.as_str()) } diff --git a/pgdog/src/plugin.rs b/pgdog/src/plugin.rs index 0d8ba4f..079996c 100644 --- a/pgdog/src/plugin.rs +++ b/pgdog/src/plugin.rs @@ -61,7 +61,11 @@ pub fn load(names: &[&str]) -> Result<(), libloading::Error> { /// Get plugin by name. pub fn plugin(name: &str) -> Option<&Plugin> { - PLUGINS.get().unwrap().iter().find(|&plugin| plugin.name() == name) + PLUGINS + .get() + .unwrap() + .iter() + .find(|&plugin| plugin.name() == name) } /// Get all loaded plugins. diff --git a/plugins/pgdog-routing/src/lib.rs b/plugins/pgdog-routing/src/lib.rs index 6a13971..96bfcff 100644 --- a/plugins/pgdog-routing/src/lib.rs +++ b/plugins/pgdog-routing/src/lib.rs @@ -17,18 +17,22 @@ pub extern "C" fn pgdog_route_query(query: bindings::Query) -> Route { fn route_internal(query: &str) -> Result { let ast = parse(query)?; - if let Some(query) = ast.protobuf.stmts.first() { if let Some(ref node) = query.stmt { match node.node { - Some(NodeEnum::SelectStmt(ref _stmt)) => { - return Ok(Route { - affinity: Affinity_READ, - shard: Shard_ANY, - }); - } + if let Some(query) = ast.protobuf.stmts.first() { + if let Some(ref node) = query.stmt { + match node.node { + Some(NodeEnum::SelectStmt(ref _stmt)) => { + return Ok(Route { + affinity: Affinity_READ, + shard: Shard_ANY, + }); + } - Some(_) => (), + Some(_) => (), - None => (), - } } } + None => (), + } + } + } Ok(Route { affinity: Affinity_WRITE,