feature/smbcloud-cli-release-npm
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | use tokio_postgres::{Error, NoTls}; |
| 2 | |
| 3 | #[tokio::main] |
| 4 | async fn main() -> Result<(), Error> { |
| 5 | println!("Hello, GresIQ client!"); |
| 6 | |
| 7 | // Connect to the database. |
| 8 | let (client, connection) = |
| 9 | tokio_postgres::connect("host=localhost user=postgres", NoTls).await?; |
| 10 | |
| 11 | // The connection object performs the actual communication with the database, |
| 12 | // so spawn it off to run on its own. |
| 13 | tokio::spawn(async move { |
| 14 | if let Err(e) = connection.await { |
| 15 | eprintln!("connection error: {}", e); |
| 16 | } |
| 17 | }); |
| 18 | |
| 19 | // Now we can execute a simple statement that just returns its parameter. |
| 20 | let rows = client.query("SELECT $1::TEXT", &[&"hello world"]).await?; |
| 21 | |
| 22 | // And then check that we got back the same string we sent over. |
| 23 | let value: &str = rows[0].get(0); |
| 24 | assert_eq!(value, "hello world"); |
| 25 | |
| 26 | Ok(()) |
| 27 | } |