diff --git a/README.md b/README.md index 359dfff..863098e 100644 --- a/README.md +++ b/README.md @@ -12,32 +12,27 @@ This repo is a lightweight connection between the following excellent packages: ### Installation: -1. [Install Rust](https://www.rust-lang.org/tools/install) - - `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` - - -2. Install [PGX](https://github.com/zombodb/pgx) - - `cargo install cargo-pgx` - - -3. Download this repo - - `curl -L 'https://github.com/jefbarn/pgx_json_schema/archive/refs/tags/0.1.0.tar.gz' | tar -xz --strip-components=1` +```shell +# [Install Rust](https://www.rust-lang.org/tools/install) +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +# Install PGX +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -4. Build and install the extension package +# Download this repo +curl -L 'https://github.com/jefbarn/pgx_json_schema/archive/refs/tags/0.1.0.tar.gz' \ + | tar -xz --strip-components=1 - `cargo pgx package` +# Build and install the extension package +cargo pgx package +# Enable the extension in your database +create extension pgx_json_schema; +``` -5. Enable the extension in your database - - `create extension pgx_json_schema;` ### How to use: -```postgresql +``` select * from json_schema_is_valid('{"maxLength": 5}'::jsonb, '"foobar"'::jsonb); json_schema_is_valid @@ -46,7 +41,7 @@ f ``` -```postgresql +``` select * from json_schema_get_errors('{"maxLength": 5}'::jsonb, '"foobar"'::jsonb); error_value | description | details | instance_path | schema_path