packages feed

opaleye 0.6.7004.1 → 0.6.7004.2

raw patch · 10 files changed

+48/−20 lines, 10 filesdep ~aesonPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson

API changes (from Hackage documentation)

+ Opaleye.Internal.PrimQuery: LeftJoinLateral :: JoinType
+ Opaleye.Internal.Sql: LeftJoinLateral :: JoinType
- Opaleye.Internal.Table: Table :: String -> TableFields writerColumns viewColumns -> Table writerColumns viewColumns
+ Opaleye.Internal.Table: Table :: String -> TableFields writeFields viewFields -> Table writeFields viewFields
- Opaleye.Internal.Table: TableWithSchema :: String -> String -> TableFields writerColumns viewColumns -> Table writerColumns viewColumns
+ Opaleye.Internal.Table: TableWithSchema :: String -> String -> TableFields writeFields viewFields -> Table writeFields viewFields
- Opaleye.Internal.Table: data Table writerColumns viewColumns
+ Opaleye.Internal.Table: data Table writeFields viewFields
- Opaleye.Internal.Table: readOnly :: String -> TableColumns () (Column a)
+ Opaleye.Internal.Table: readOnly :: String -> TableFields () (Column a)
- Opaleye.Table: Table :: String -> TableFields writerColumns viewColumns -> Table writerColumns viewColumns
+ Opaleye.Table: Table :: String -> TableFields writeFields viewFields -> Table writeFields viewFields
- Opaleye.Table: TableWithSchema :: String -> String -> TableFields writerColumns viewColumns -> Table writerColumns viewColumns
+ Opaleye.Table: TableWithSchema :: String -> String -> TableFields writeFields viewFields -> Table writeFields viewFields
- Opaleye.Table: data Table writerColumns viewColumns
+ Opaleye.Table: data Table writeFields viewFields
- Opaleye.Table: readOnly :: String -> TableColumns () (Column a)
+ Opaleye.Table: readOnly :: String -> TableFields () (Column a)

Files

Doc/Tutorial/TutorialAdvanced.lhs view
@@ -5,7 +5,7 @@ > import           Prelude hiding (sum) > > import           Opaleye (Select, Field, Table, table, tableField,->                           queryTable, SqlText, SqlInt4, Aggregator,+>                           selectTable, SqlText, SqlInt4, Aggregator, >                           aggregate) > import qualified Opaleye.Aggregate as A > import           Opaleye.Aggregate ()@@ -43,7 +43,7 @@ >                                       , tableField "child_age" ))  > rangeOfChildrensAges :: Select (Field SqlText, Field SqlInt4)-> rangeOfChildrensAges = aggregate (p2 (A.groupBy, range)) (queryTable personTable)+> rangeOfChildrensAges = aggregate (p2 (A.groupBy, range)) (selectTable personTable)   TutorialAdvanced> printSql rangeOfChildrensAges
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014-2019 Purely Agile Limited, Tom Ellis+Copyright (c) 2014-2018 Purely Agile Limited; 2019-2020 Tom Ellis  All rights reserved. 
README.md view
@@ -15,6 +15,13 @@   Bergmark](http://ircbrowse.net/browse/haskell?id=22634197&timestamp=1460980502#t1460980502),   [Silk.co](http://www.silk.co/) +> "Opaleye is absolutely fantastic. It has been solid in production+  for years!" – [Matt Wraith](https://github.com/wraithm)++> "Opaleye just works, and it’s my personal recommendation ... I like+  it a lot" – [William+  Yao](https://www.williamyaoh.com/posts/2019-12-14-typesafe-db-libraries.html)+ Opaleye allows you to define your database tables and write queries against them in Haskell code, and aims to be typesafe in the sense that if your code compiles then the generated SQL query will not fail@@ -37,6 +44,10 @@ * [Basic tutorial](https://github.com/tomjaguarpaw/haskell-opaleye/blob/master/Doc/Tutorial/TutorialBasic.lhs) * [Manipulation tutorial](https://github.com/tomjaguarpaw/haskell-opaleye/blob/master/Doc/Tutorial/TutorialManipulation.lhs) +### Advanced++* [Abstracting out common columns in Opaleye](https://www.williamyaoh.com/posts/2019-12-28-abstracting-out-common-columns-opaleye.html)+ # Contact  ## Contact the author@@ -49,10 +60,12 @@ Please file bugs on the [Opaleye GitHub issue tracking page](https://github.com/tomjaguarpaw/haskell-opaleye/issues/). -## Mailing list+## Discuss and ask questions about Opaleye -Please join the [opaleye-users mailing-list](https://lists.sourceforge.net/lists/listinfo/opaleye-users).+You are welcome to use the [Opaleye GitHub issue tracking+page](https://github.com/tomjaguarpaw/haskell-opaleye/issues/) for+discussion of or questions about Opaleye even if they don't relate to+a bug or issue.  # `Internal` modules 
opaleye.cabal view
@@ -1,6 +1,6 @@ name:            opaleye-copyright:       Copyright (c) 2014-2019 Purely Agile Limited-version:         0.6.7004.1+copyright:       Copyright (c) 2014-2018 Purely Agile Limited; 2019-2020 Tom Ellis+version:         0.6.7004.2 synopsis:        An SQL-generating DSL targeting PostgreSQL description:     An SQL-generating DSL targeting PostgreSQL.  Allows                  Postgres queries to be written within Haskell in a@@ -18,7 +18,7 @@                  CHANGELOG.md                  *.md                  Doc/*.md-tested-with:     GHC==8.8.1, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2+tested-with:     GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2  source-repository head   type:     git
src/Opaleye/Internal/PrimQuery.hs view
@@ -18,7 +18,7 @@            | IntersectAll              deriving Show -data JoinType = LeftJoin | RightJoin | FullJoin deriving Show+data JoinType = LeftJoin | RightJoin | FullJoin | LeftJoinLateral deriving Show  data TableIdentifier = TableIdentifier   { tiSchemaName :: Maybe String
src/Opaleye/Internal/Print.hs view
@@ -95,6 +95,7 @@ ppJoinType Sql.LeftJoin = text "LEFT OUTER JOIN" ppJoinType Sql.RightJoin = text "RIGHT OUTER JOIN" ppJoinType Sql.FullJoin = text "FULL OUTER JOIN"+ppJoinType Sql.LeftJoinLateral = text "LEFT OUTER JOIN LATERAL"  ppAttrs :: Sql.SelectAttrs -> Doc ppAttrs Sql.Star                 = text "*"
src/Opaleye/Internal/Sql.hs view
@@ -65,7 +65,7 @@   bSelect2 :: Select } deriving Show -data JoinType = LeftJoin | RightJoin | FullJoin deriving Show+data JoinType = LeftJoin | RightJoin | FullJoin | LeftJoinLateral deriving Show data BinOp = Except | ExceptAll | Union | UnionAll | Intersect | IntersectAll deriving Show  data Label = Label {@@ -219,6 +219,7 @@ joinType PQ.LeftJoin = LeftJoin joinType PQ.RightJoin = RightJoin joinType PQ.FullJoin = FullJoin+joinType PQ.LeftJoinLateral = LeftJoinLateral  binOp :: PQ.BinOp -> BinOp binOp o = case o of
src/Opaleye/Internal/Table.hs view
@@ -51,11 +51,11 @@ -- -- The constructors of Table are internal only and will be -- deprecated in version 0.7.-data Table writerColumns viewColumns-  = Table String (TableFields writerColumns viewColumns)+data Table writeFields viewFields+  = Table String (TableFields writeFields viewFields)     -- ^ For unqualified table names. Do not use the constructor.  It     -- is internal and will be deprecated in version 0.7.-  | TableWithSchema String String (TableFields writerColumns viewColumns)+  | TableWithSchema String String (TableFields writeFields viewFields)     -- ^ Schema name, table name, table properties.  Do not use the     -- constructor.  It is internal and will be deprecated in version 0.7. @@ -113,23 +113,23 @@   Writer (forall f. Functor f =>           PM.PackMap (f HPQ.PrimExpr, String) () (f columns) ()) --- | 'required' is for columns which are not 'optional'.  You must+-- | 'required' is for fields which are not 'optional'.  You must -- provide them on writes. required :: String -> TableFields (Column a) (Column a) required columnName = TableProperties   (requiredW columnName)   (View (Column (HPQ.BaseTableAttrExpr columnName))) --- | 'optional' is for columns that you can omit on writes, such as+-- | 'optional' is for fields that you can omit on writes, such as --  columns which have defaults or which are SERIAL. optional :: String -> TableFields (Maybe (Column a)) (Column a) optional columnName = TableProperties   (optionalW columnName)   (View (Column (HPQ.BaseTableAttrExpr columnName))) --- | 'readOnly' is for columns that you must omit on writes, such as+-- | 'readOnly' is for fields that you must omit on writes, such as --  SERIAL columns intended to auto-increment only.-readOnly :: String -> TableColumns () (Column a)+readOnly :: String -> TableFields () (Column a) readOnly = lmap (const Nothing) . optional  class TableColumn writeType sqlType | writeType -> sqlType where
src/Opaleye/Internal/TypeFamilies.hs view
@@ -24,12 +24,17 @@ data NullsT data WT +-- | Used in 'RecordField' and 'TableRecordField' for a non-nullable+-- field type NN = 'F.NonNullable+-- | Used in 'RecordField' and 'TableRecordField' for a nullable field type N  = 'F.Nullable  data Optionality = OReq | OOpt +-- | 'TableRecordField' for a required field type Req = 'OReq+-- | 'TableRecordField' for an optional field type Opt = 'OOpt  type family A (a :: Arr h k1 k2) (b :: k1) :: k2@@ -59,7 +64,7 @@ type instance A ('H HT) ('C '(h, o, N))  = Maybe h type instance A ('H OT) ('C '(h, o, NN)) = Column o type instance A ('H OT) ('C '(h, o, N))  = Column (Nullable o)-type instance A ('H NullsT) ('C '(h, o, NN)) = Column (Nullable o)+type instance A ('H NullsT) ('C '(h, o, n)) = Column (Nullable o)  type instance A ('H HT) ('TC '(t, b)) = A ('H HT) ('C t) type instance A ('H OT) ('TC '(t, b)) = A ('H OT) ('C t)@@ -73,8 +78,16 @@ -- in version 0.7. type TableField f a b c d = TableRecordField f a b c d +-- | Type families parameter for Haskell types ('String', 'Int', etc.) type H = 'H HT+-- | Type families parameter for Opaleye types ('Opaleye.Field.Field'+-- 'Opaleye.SqlString', 'Opaleye.Field.Field' 'Opaleye.SqlInt4', etc.) type O = 'H OT+-- | Type families parameter for nulled Opaleye types+-- ('Opaleye.Field.FieldNullable' 'Opaleye.SqlString',+-- 'Opaleye.Field.FieldNullable' 'Opaleye.SqlInt4', etc.) type Nulls = 'H NullsT+-- | Type families parameter for Opaleye write types (i.e. wrapped in+-- 'Maybe' for optional types) type W = 'H WT type F = 'H
src/Opaleye/SqlTypes.hs view
@@ -1,6 +1,6 @@ -- | SQL types and functions to create 'Opaleye.Field.Field_'s of -- those types.  You may find it more convenient to use--- "Opaleye.Constant" instead.+-- "Opaleye.ToFields" instead.  module Opaleye.SqlTypes (module Opaleye.SqlTypes,                          P.IsSqlType,