nix: add postgrest-repl command
This commit is contained in:
committed by
Steve Chavez
parent
32b77cae6c
commit
739f056b0a
+18
-1
@@ -242,7 +242,7 @@ the check resulted in any uncommited changes. It's mostly useful for CI.
|
|||||||
|
|
||||||
## General development tools
|
## General development tools
|
||||||
|
|
||||||
Tools like `postgrest-build`, `postgrest-run` etc. are simple wrappers around
|
Tools like `postgrest-build`, `postgrest-run`, `postgrest-repl` etc. are simple wrappers around
|
||||||
`cabal` and should do what you expect. `postgrest-check` runs most checks that will
|
`cabal` and should do what you expect. `postgrest-check` runs most checks that will
|
||||||
also run in CI, with the exception of the IO and Memory checks that need to be run
|
also run in CI, with the exception of the IO and Memory checks that need to be run
|
||||||
separately.
|
separately.
|
||||||
@@ -256,6 +256,23 @@ run against the latest PostgreSQL version by default.
|
|||||||
file is changed. For example, `postgrest-watch postgrest-with-all postgrest-test-spec`
|
file is changed. For example, `postgrest-watch postgrest-with-all postgrest-test-spec`
|
||||||
will re-run the full spec test suite against all PostgreSQL versions on every change.
|
will re-run the full spec test suite against all PostgreSQL versions on every change.
|
||||||
|
|
||||||
|
## REPL
|
||||||
|
|
||||||
|
You can use `postgrest-repl` to manually inspect the PostgREST modules.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ postgrest-repl
|
||||||
|
|
||||||
|
ghci> import PostgREST.<tab>
|
||||||
|
PostgREST.Admin PostgREST.Config.Database PostgREST.Plan.MutatePlan PostgREST.Response.OpenAPI
|
||||||
|
PostgREST.ApiRequest PostgREST.Config.JSPath PostgREST.Plan.ReadPlan PostgREST.SchemaCache
|
||||||
|
...
|
||||||
|
|
||||||
|
ghci> import PostgREST.MediaType
|
||||||
|
ghci> decodeMediaType "application/json"
|
||||||
|
MTApplicationJSON
|
||||||
|
```
|
||||||
|
|
||||||
## Tour
|
## Tour
|
||||||
|
|
||||||
The following is not required for working on PostgREST with Nix, but it will
|
The following is not required for working on PostgREST with Nix, but it will
|
||||||
|
|||||||
@@ -57,6 +57,18 @@ let
|
|||||||
postgrest "''${_arg_leftovers[@]}"
|
postgrest "''${_arg_leftovers[@]}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
repl =
|
||||||
|
checkedShellScript
|
||||||
|
{
|
||||||
|
name = "postgrest-repl";
|
||||||
|
docs = "Interact with PostgREST modules using the cabal repl";
|
||||||
|
args = [ "ARG_LEFTOVERS([cabal v2-repl arguments])" ];
|
||||||
|
inRootDir = true;
|
||||||
|
withEnv = postgrest.env;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
exec ${cabal-install}/bin/cabal v2-repl "''${_arg_leftovers[@]}"
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
buildToolbox
|
buildToolbox
|
||||||
{
|
{
|
||||||
@@ -65,5 +77,6 @@ buildToolbox
|
|||||||
build
|
build
|
||||||
clean
|
clean
|
||||||
run
|
run
|
||||||
|
repl
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user