https://github.com/kkazuo/pgez
Eazy wrapper of postgresql
https://github.com/kkazuo/pgez
core ocaml postgresql
Last synced: about 2 months ago
JSON representation
Eazy wrapper of postgresql
- Host: GitHub
- URL: https://github.com/kkazuo/pgez
- Owner: kkazuo
- License: isc
- Created: 2019-02-10T14:52:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T14:32:34.000Z (over 7 years ago)
- Last Synced: 2025-01-16T03:49:40.645Z (over 1 year ago)
- Topics: core, ocaml, postgresql
- Language: OCaml
- Size: 7.81 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pgez
Eazy wrapper of postgresql.
```
let db = new Postgresql.connection () in
Pgez.with_transaction ~db ~f:begin fun () ->
Pgez.exec ~db {|
SELECT name FROM Names
WHERE uid = $1
|} ~params:[| `Int 1234 |]
|> Result.return
end
|> function
| Ok [ [| `String name |] ] ->
Log.Global.info "found %s." name
| Ok r -> r
|> [%sexp_of: Pgez.Value.t array list]
|> Sexp.to_string
|> Log.Global.info "%s"
| Error _ ->
();
```