From 5f3c8173096fe46b3fa1d075434ba7c59ad6f2cc Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 23 Feb 2023 12:41:03 -0800 Subject: [PATCH] Bump version to 3.5.9.0 --- changelog.md | 8 ++++++-- src/Database/Esqueleto/Experimental/From/Join.hs | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 861494708..ceffbf5f9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ -3.5.9.2 -======= +3.5.9.0 +======== +- @9999years + - #350 + - Add `GetFirstTable`, `getTable`, `getTableMaybe` helpers for selecting + tables from `:&` chains - @josephsumabat - [#339](https://github.com/bitemyapp/esqueleto/pull/333) - Add `forUpdateOf`, `forShareOf` locking kinds for postgres diff --git a/src/Database/Esqueleto/Experimental/From/Join.hs b/src/Database/Esqueleto/Experimental/From/Join.hs index 720122391..b4d9ae2d1 100644 --- a/src/Database/Esqueleto/Experimental/From/Join.hs +++ b/src/Database/Esqueleto/Experimental/From/Join.hs @@ -348,8 +348,12 @@ infixl 2 `innerJoin`, -- -- Note that this typeclass will only select the first table of the given type; -- it may be less useful if there's multiple tables of the same type. +-- +-- @since 3.5.9.0 class GetFirstTable t ts where -- | Get the first table of type `t` from the tables `ts`. + -- + -- @since 3.5.9.0 getFirstTable :: ts -> t instance GetFirstTable t (t :& ts) where @@ -382,12 +386,16 @@ instance {-# OVERLAPPABLE #-} GetFirstTable t ts => GetFirstTable t (ts :& x) wh -- -- This example is a bit trivial, but once you've joined five or six tables it -- becomes enormously helpful. +-- +-- @since 3.5.9.0 getTable :: forall t ts. GetFirstTable (SqlExpr (Entity t)) ts => ts -> SqlExpr (Entity t) getTable = getFirstTable -- | A variant of `getTable` that operates on possibly-null entities. +-- +-- @since 3.5.9.0 getTableMaybe :: forall t ts. GetFirstTable (SqlExpr (Maybe (Entity t))) ts => ts -> SqlExpr (Maybe (Entity t))