-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b040e75
commit fe85044
Showing
32 changed files
with
526 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
module Database.Persist.Sql.Lifted.Expression | ||
( -- * Type | ||
SqlExpr | ||
|
||
-- * Constant | ||
, val | ||
|
||
-- * Bool | ||
, not_ | ||
, (&&.) | ||
, (||.) | ||
|
||
-- * Case | ||
, case_ | ||
, when_ | ||
, then_ | ||
, else_ | ||
|
||
-- * Comparison | ||
, (==.) | ||
, (!=.) | ||
, (>=.) | ||
, (>.) | ||
, (<=.) | ||
, (<.) | ||
, between | ||
|
||
-- * Count | ||
, count | ||
, countRows | ||
, countDistinct | ||
|
||
-- * Exists | ||
, exists | ||
, notExists | ||
|
||
-- * Insert | ||
, (<#) | ||
, (<&>) | ||
|
||
-- * Key | ||
, toBaseId | ||
, ToBaseId (..) | ||
|
||
-- * List | ||
, in_ | ||
, notIn | ||
, subList_select | ||
, valList | ||
, justList | ||
|
||
-- * Maybe | ||
, isNothing | ||
, isNothing_ | ||
, just | ||
, nothing | ||
, joinV | ||
, coalesce | ||
, coalesceDefault | ||
|
||
-- * Number | ||
, (+.) | ||
, (-.) | ||
, (/.) | ||
, (*.) | ||
, round_ | ||
, ceiling_ | ||
, floor_ | ||
, min_ | ||
, max_ | ||
, sum_ | ||
, avg_ | ||
, castNum | ||
, castNumM | ||
|
||
-- * OrderBy | ||
, asc | ||
, desc | ||
, rand | ||
|
||
-- * Projection | ||
, (^.) | ||
, (?.) | ||
|
||
-- * String | ||
, lower_ | ||
, upper_ | ||
, trim_ | ||
, ltrim_ | ||
, rtrim_ | ||
, length_ | ||
, left_ | ||
, right_ | ||
, like | ||
, ilike | ||
, (%) | ||
, concat_ | ||
, (++.) | ||
, castString | ||
|
||
-- * SubSelect | ||
, subSelect | ||
, subSelectMaybe | ||
, subSelectCount | ||
, subSelectForeign | ||
, subSelectList | ||
, subSelectUnsafe | ||
|
||
-- * Table | ||
, getTable | ||
, getTableMaybe | ||
|
||
-- * Update | ||
, (=.) | ||
, (+=.) | ||
, (-=.) | ||
, (*=.) | ||
, (/=.) | ||
) where | ||
|
||
import Database.Persist.Sql.Lifted.Expression.Bool | ||
import Database.Persist.Sql.Lifted.Expression.Case | ||
import Database.Persist.Sql.Lifted.Expression.Comparison | ||
import Database.Persist.Sql.Lifted.Expression.Constant | ||
import Database.Persist.Sql.Lifted.Expression.Count | ||
import Database.Persist.Sql.Lifted.Expression.Exists | ||
import Database.Persist.Sql.Lifted.Expression.Insert | ||
import Database.Persist.Sql.Lifted.Expression.Key | ||
import Database.Persist.Sql.Lifted.Expression.List | ||
import Database.Persist.Sql.Lifted.Expression.Maybe | ||
import Database.Persist.Sql.Lifted.Expression.Number | ||
import Database.Persist.Sql.Lifted.Expression.OrderBy | ||
import Database.Persist.Sql.Lifted.Expression.Projection | ||
import Database.Persist.Sql.Lifted.Expression.String | ||
import Database.Persist.Sql.Lifted.Expression.SubSelect | ||
import Database.Persist.Sql.Lifted.Expression.Table | ||
import Database.Persist.Sql.Lifted.Expression.Type | ||
import Database.Persist.Sql.Lifted.Expression.Update |
7 changes: 7 additions & 0 deletions
7
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Bool.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Bool | ||
( not_ | ||
, (&&.) | ||
, (||.) | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
8 changes: 8 additions & 0 deletions
8
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Case.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Case | ||
( case_ | ||
, when_ | ||
, then_ | ||
, else_ | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
14 changes: 14 additions & 0 deletions
14
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Comparison.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Comparison | ||
( -- * Equality | ||
(==.) | ||
, (!=.) | ||
|
||
-- * Less & greater | ||
, (>=.) | ||
, (>.) | ||
, (<=.) | ||
, (<.) | ||
, between | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
5 changes: 5 additions & 0 deletions
5
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Constant.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Constant | ||
( val | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
7 changes: 7 additions & 0 deletions
7
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Count.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Count | ||
( count | ||
, countRows | ||
, countDistinct | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
6 changes: 6 additions & 0 deletions
6
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Exists.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Exists | ||
( exists | ||
, notExists | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
6 changes: 6 additions & 0 deletions
6
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Insert.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Insert | ||
( (<#) | ||
, (<&>) | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
6 changes: 6 additions & 0 deletions
6
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Key.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Key | ||
( toBaseId | ||
, ToBaseId (..) | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
9 changes: 9 additions & 0 deletions
9
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/List.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Database.Persist.Sql.Lifted.Expression.List | ||
( in_ | ||
, notIn | ||
, subList_select | ||
, valList | ||
, justList | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
11 changes: 11 additions & 0 deletions
11
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Maybe.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Maybe | ||
( isNothing | ||
, isNothing_ | ||
, just | ||
, nothing | ||
, joinV | ||
, coalesce | ||
, coalesceDefault | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
17 changes: 17 additions & 0 deletions
17
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Number.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Number | ||
( (+.) | ||
, (-.) | ||
, (/.) | ||
, (*.) | ||
, round_ | ||
, ceiling_ | ||
, floor_ | ||
, min_ | ||
, max_ | ||
, sum_ | ||
, avg_ | ||
, castNum | ||
, castNumM | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
7 changes: 7 additions & 0 deletions
7
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/OrderBy.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Database.Persist.Sql.Lifted.Expression.OrderBy | ||
( asc | ||
, desc | ||
, rand | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
6 changes: 6 additions & 0 deletions
6
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Projection.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Projection | ||
( (^.) | ||
, (?.) | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
18 changes: 18 additions & 0 deletions
18
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/String.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Database.Persist.Sql.Lifted.Expression.String | ||
( lower_ | ||
, upper_ | ||
, trim_ | ||
, ltrim_ | ||
, rtrim_ | ||
, length_ | ||
, left_ | ||
, right_ | ||
, like | ||
, ilike | ||
, (%) | ||
, concat_ | ||
, (++.) | ||
, castString | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
10 changes: 10 additions & 0 deletions
10
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/SubSelect.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Database.Persist.Sql.Lifted.Expression.SubSelect | ||
( subSelect | ||
, subSelectMaybe | ||
, subSelectCount | ||
, subSelectForeign | ||
, subSelectList | ||
, subSelectUnsafe | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
6 changes: 6 additions & 0 deletions
6
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Table.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Table | ||
( getTable | ||
, getTableMaybe | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
5 changes: 5 additions & 0 deletions
5
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Type.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Type | ||
( SqlExpr | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
9 changes: 9 additions & 0 deletions
9
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Expression/Update.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Database.Persist.Sql.Lifted.Expression.Update | ||
( (=.) | ||
, (+=.) | ||
, (-=.) | ||
, (*=.) | ||
, (/=.) | ||
) where | ||
|
||
import Database.Esqueleto.Experimental |
23 changes: 23 additions & 0 deletions
23
persistent-sql-lifted/library/Database/Persist/Sql/Lifted/Filter.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Database.Persist.Sql.Lifted.Filter | ||
( -- * Type | ||
Filter | ||
|
||
-- * Equality | ||
, (==.) | ||
, (!=.) | ||
|
||
-- * Less & greater | ||
, (<.) | ||
, (>.) | ||
, (<=.) | ||
, (>=.) | ||
|
||
-- * Lists | ||
, (<-.) | ||
, (/<-.) | ||
|
||
-- * Disjunction | ||
, (||.) | ||
) where | ||
|
||
import Database.Persist |
Oops, something went wrong.