Xuanwo commented on code in PR #3495:
URL: 
https://github.com/apache/incubator-opendal/pull/3495#discussion_r1384222670


##########
core/src/services/postgresql/backend.rs:
##########
@@ -24,30 +24,61 @@ use std::sync::Arc;
 use async_trait::async_trait;
 use bb8::Pool;
 use bb8_postgres::PostgresConnectionManager;
+use serde::Deserialize;
 use tokio::sync::OnceCell;
 use tokio_postgres::Config;
 
 use crate::raw::adapters::kv;
 use crate::raw::*;
 use crate::*;
 
-/// [Postgresql](https://www.postgresql.org/) services support.
-#[doc = include_str!("docs.md")]
-#[derive(Default)]
-pub struct PostgresqlBuilder {
+/// Config for PostGresQL services support.
+#[derive(Default, Deserialize)]
+#[serde(default)]
+#[non_exhaustive]
+pub struct PostgresqlConfig {
+    /// root of this backend.
+    ///
+    /// All operations will happen under this root.
+    ///
+    /// default to `/` if not set.
+    pub root: Option<String>,
+    /// the connection string of postgres server
     connection_string: Option<String>,
-
+    /// the table of postgresql
     table: Option<String>,
+    /// the key field of postgresql
     key_field: Option<String>,
+    /// the value field of postgresql
     value_field: Option<String>,
-    root: Option<String>,
+}
+
+impl Debug for PostgresqlConfig {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut d = f.debug_struct("PostgresqlConfig");
+
+        d.field("root", &self.root)
+            .field("connection_string", &self.connection_string)

Review Comment:
   Avoid printing `connection_string` directly as it may include sensitive 
information. You can handle it in this way:
   
   ```rust
           if self.connection_string.is_some() {
               d.field("connection_string", &"<redacted>");
           }
   ```



##########
core/src/services/postgresql/mod.rs:
##########
@@ -17,3 +17,4 @@
 
 mod backend;
 pub use backend::PostgresqlBuilder as Postgresql;
+pub use backend::PostgresqlConfig;

Review Comment:
   Please also expose this at `services/mod.rs`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to