From 6f8b13714a1cfb1c04ec54043b4da99d047af072 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda <41065217+TaKO8Ki@users.noreply.github.com> Date: Wed, 8 Sep 2021 13:04:50 +0900 Subject: [PATCH] Add number type to postgres (#78) * add number type to postgres * fix README * add bool type to postgres * add contribution section --- README.md | 6 +++++- src/database/postgres.rs | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fac6e1b..365c1f8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ A cross-platform TUI database management tool written in Rust ## TODOs -- [ ] Query widget +- [ ] SQL editor - [ ] Custom key bindings - [ ] Custom theme settings - [ ] Support the other databases @@ -119,3 +119,7 @@ database = "bar" type = "sqlite" path = "/path/to/baz.db" ``` + +## Contribution + +Contributions, issues and pull requests are welcome! diff --git a/src/database/postgres.rs b/src/database/postgres.rs index 537b55a..f600c06 100644 --- a/src/database/postgres.rs +++ b/src/database/postgres.rs @@ -252,7 +252,15 @@ impl Pool for PostgresPool { serde_json::Value::Array(v) => { new_row.push(v.iter().map(|v| v.to_string()).join(",")) } - _ => (), + serde_json::Value::Number(v) => new_row.push(v.to_string()), + serde_json::Value::Bool(v) => new_row.push(v.to_string()), + others => { + panic!( + "column type not implemented: `{}` {}", + column.name(), + others + ) + } } } }