Update readme

This commit is contained in:
rightfold 2017-06-03 14:00:23 +02:00
parent ac05e01a97
commit 4fd8c42515
No known key found for this signature in database
GPG Key ID: 199D0373AC917A8F

View File

@ -3,42 +3,3 @@
purescript-postgresql-client is a PostgreSQL client library for PureScript.
To use this library, you need to add `pg` as an npm dependency.
Included is an optional preprocessor, purspgpp, which finds embedded SQL
queries in PureScript source files and infers their types. Such queries can be
written as follows:
```purescript
userName = [query|
SELECT first_name, last_name
FROM users
WHERE id = $1
|]
```
purspgpp will replace this by something like the following:
```purescript
(Query """
SELECT first_name, last_name
FROM users
WHERE id = $1
""" :: Query (Tuple UUID Unit) (Tuple String (Tuple String Unit))
```
You can integrate purspgpp into your build system. For example, here is a
PowerShell script that executes it for all `.purspg` files:
```powershell
Get-ChildItem src -Recurse -Filter *.purspg `
| ForEach-Object {
perl6 `
bower_components/purescript-postgresql-client/purspgpp `
"user=postgres password=lol123 dbname=nn" `
"$($_.FullName)" `
"$([IO.Path]::ChangeExtension($_.FullName, "purs"))"
if (!$?) {
Write-Error "Unable to preprocess $_"
}
}
```