Some doc clarifications

This commit is contained in:
Sean Corfield 2019-06-08 18:11:16 -07:00
parent d50917fc9f
commit a09612cebe
3 changed files with 5 additions and 3 deletions

View file

@ -4,9 +4,9 @@ Only accretive/fixative changes will be made from now on.
## Unreleased Changes
The following changes have been committed to the **master** branch and will be in the next release:
The following changes have been committed to the **master** branch and will be in the 1.0.0 release:
* Fix #26 by exposing `next.jdbc.result-set/datafiable-result-set` so that various `java.sql.DatabaseMetaData` methods that result metadata information in `ResultSet`s can be easily turned into a fully realized result set.
* Fix #26 by exposing `next.jdbc.result-set/datafiable-result-set` so that various `java.sql.DatabaseMetaData` methods that return result metadata information in `ResultSet`s can be easily turned into a fully realized result set.
## Stable Builds

View file

@ -28,7 +28,7 @@ I also wanted `datafy`/`nav` support baked right in (it was added to `clojure.ja
As `next.jdbc` moved from alpha to beta, the last breaking change was made (renaming `reducible!` to `plan`) and the API should now be considered stable. Only accretive and fixative changes will be made from now on.
After a month of alpha builds being available for testing, the first [beta build is available on Clojars](https://clojars.org/seancorfield/next.jdbc) (as of 2019-05-24). In addition to the small, core API in `next.jdbc`, there are "syntactic sugar" SQL functions (`insert!`, `query`, `update!`, and `delete!`) available in `next.jdbc.sql` that are similar to the main API in `clojure.java.jdbc`. See [Migrating from `clojure.java.jdbc`](/doc/migration-from-clojure-java-jdbc.md) for more detail about the differences.
After a month of alpha builds being available for testing, the first beta build was released on June 24th, 2019. A [release candidate build is currently available on Clojars](https://clojars.org/seancorfield/next.jdbc) (as of 2019-06-04). In addition to the small, core API in `next.jdbc`, there are "syntactic sugar" SQL functions (`insert!`, `query`, `update!`, and `delete!`) available in `next.jdbc.sql` that are similar to the main API in `clojure.java.jdbc`. See [Migrating from `clojure.java.jdbc`](/doc/migration-from-clojure-java-jdbc.md) for more detail about the differences.
## Usage

View file

@ -14,6 +14,8 @@ Here's how the process works:
* If a column in a row represents a foreign key into another table, calling `nav` will fetch the related row(s),
* Those can in turn be `datafy`'d and `nav`'d to continue drilling down through connected data in the database.
In addition to `execute!` and `execute-one!`, you can call `next.jdbc.result-set/datafiable-result-set` on any `ResultSet` object to produce a result set whose rows are `Datafiable`. Inside a reduction over the result of `plan`, you can call `next.jdbc.result-set/datafiable-row` on a row to produce a `Datafiable` row. That will realize the entire row, including generating column names using the row builder specified (or `as-maps` by default).
## Identifying Foreign Keys
By default, `next.jdbc` assumes that a column named `<something>id` or `<something>_id` is a foreign key into a table called `<something>` with a primary key called `id`. As an example, if you have a table `address` which has columns `id` (the primary key), `name`, `email`, etc, and a table `contact` which has various columns including `addressid`, then if you retrieve a result set based on `contact`, call `datafy` on it and then "drill down" into the columns, when `(nav row :contact/addressid v)` is called (where `v` is the value of that column in that row) `next.jdbc`'s implementation of `nav` will fetch a single row from the `address` table, identified by `id` matching `v`.