From ef569108f07867b2d1b27d3907f9fc1f982c701d Mon Sep 17 00:00:00 2001 From: pawurb Date: Tue, 15 Oct 2024 16:49:40 +0200 Subject: [PATCH] Update readme --- README.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 43d0d4d..2f79ce4 100644 --- a/README.md +++ b/README.md @@ -21,17 +21,15 @@ Alternative versions: ## Installation ```bash -cargo add pg-extras +cargo install pg-extras ``` `calls` and `outliers` queries require [pg_stat_statements](https://www.postgresql.org/docs/current/pgstatstatements.html) extension. You can check if it is enabled in your database by running: -```rust -use pg_extras::{render_table, extensions} - -render_table(extensions()?); +```bash +pg_extras extensions ``` You should see the similar line in the output: @@ -56,7 +54,25 @@ Package expects the `ENV['PG_EXTRAS_DATABASE_URL']` or `ENV['DATABASE_URL']` val ENV["DATABASE_URL"] = "postgresql://postgres:secret@localhost:5432/database_name" ``` -You can run queries using a Rust API to display an ASCCI table with results: +You can use `pg_extras` shell command: + +```bash +$ pg_extras cache_hit ++----------------+------------------------+ +| /* Index and table hit rate */ | ++================+========================+ +| name | ratio | ++----------------+------------------------+ +| index hit rate | 0.99138647287107053837 | ++----------------+------------------------+ +| table hit rate | 0.99984856854492081787 | ++----------------+------------------------+ +``` + +## Rust API + + +You can also run queries using a Rust API to display an ASCCI table with results: ```rust use pg_extras::{render_table, cache_hit} @@ -95,22 +111,6 @@ cache_hit(Some("other_schema".to_string)).await?; You can customize the default `public` schema by setting `ENV['PG_EXTRAS_SCHEMA']` value. -## Command line - -After running `cargo install pg-extras` you can use `pg_extras` shell command: - -```bash -$ pg_extras cache_hit -+----------------+------------------------+ -| /* Index and table hit rate */ | -+================+========================+ -| name | ratio | -+----------------+------------------------+ -| index hit rate | 0.99138647287107053837 | -+----------------+------------------------+ -| table hit rate | 0.99984856854492081787 | -+----------------+------------------------+ -`````` ## Available methods