Here's how to get started working on pg_idkit
locally.
To work on pg_idkit
, you'll need the following:
- Rust toolchain (via
rustup
) cargo-pgrx
(see below for more details)cargo-get
just
(see below for more details)- (optional)
git-crypt
(for working with secrets) - (optional) direnv
- (optional) Docker
- (optional)
cargo-watch
This project uses a task runner similar to make
called just
. You can install it easily with cargo
:
cargo install --locked just
The PGRX project is the magic behind this extension, exposing an easy-to-program interface in Rust for Postgres extensions.
To install it:
cargo install --locked [email protected]
cargo pgrx init
To build the project:
just build
To run the build continuously for quicker local development (assuming you have cargo-watch
installed):
just build-watch
Note that you can use the pgrx
-documented development flow as well (using cargo pgrx
) as well, for example:
cargo pgrx run pg15
To run the tests:
just test
To run tests continuously for quicker local development (requires cargo-watch
):
just build-test-watch
Assuming you have Docker installed, to start a local Postgres instance first you must build a postgres
docker image with pg_idkit
:
just image
Then start the container:
just db-local
You may attach to the local DB with psql
and execute commands:
just db-local-psql