packages feed

persistent-mysql-haskell 0.1.1.0 → 0.2.0.0

raw patch · 4 files changed

+42/−10 lines, 4 filesdep +networkdep −tlsPVP ok

version bump matches the API change (PVP)

Dependencies added: network

Dependencies removed: tls

API changes (from Hackage documentation)

+ Database.Persist.MySQL: setMySQLConnectInfoCharset :: Word8 -> MySQLConnectInfo -> MySQLConnectInfo
+ Database.Persist.MySQL: setMySQLConnectInfoPort :: PortNumber -> MySQLConnectInfo -> MySQLConnectInfo
- Database.Persist.MySQL: mkMySQLConnectInfo :: String -> String -> String -> String -> MySQLConnectInfo
+ Database.Persist.MySQL: mkMySQLConnectInfo :: HostName -> ByteString -> ByteString -> ByteString -> MySQLConnectInfo

Files

ChangeLog.md view
@@ -1,3 +1,10 @@+## 0.2.0.0+- Added APIs for setting port number and character encoding.+- Updated type signature for mkMySQLConnectInfo to align with mysql-haskell.++## 0.1.1.0+- Bumped up version to include README and example.+ ## 0.1.0.0  * Ported persistent-mysql 2.6 to use mysql-haskell as the underlying database driver.
Database/Persist/MySQL.hs view
@@ -12,6 +12,8 @@   , module Database.Persist.Sql   , MySQLConnectInfo   , mkMySQLConnectInfo+  , setMySQLConnectInfoPort+  , setMySQLConnectInfoCharset   , MySQLConf   , mkMySQLConf   , mockMigration@@ -56,6 +58,8 @@ import qualified Data.Time.Calendar     as Time import qualified Data.Time.LocalTime    as Time import qualified Data.ByteString.Char8  as BSC+import qualified Network.Socket         as NetworkSocket+import qualified Data.Word              as Word  import Control.Monad.Trans.Control (MonadBaseControl) import Control.Monad.Trans.Resource (runResourceT)@@ -895,18 +899,29 @@  -- | Public constructor for @MySQLConnectInfo@. mkMySQLConnectInfo-  :: String -- ^ hostname-  -> String -- ^ username-  -> String -- ^ password-  -> String -- ^ database+  :: NetworkSocket.HostName -- ^ hostname+  -> BSC.ByteString          -- ^ username+  -> BSC.ByteString          -- ^ password+  -> BSC.ByteString          -- ^ database   -> MySQLConnectInfo mkMySQLConnectInfo host user pass db   = MySQLConnectInfo   $ MySQL.defaultConnectInfo {       MySQL.ciHost     = host-    , MySQL.ciUser     = BSC.pack user-    , MySQL.ciPassword = BSC.pack pass-    , MySQL.ciDatabase = BSC.pack db+    , MySQL.ciUser     = user+    , MySQL.ciPassword = pass+    , MySQL.ciDatabase = db   }++-- | Update port number for @MySQLConnectInfo@.+setMySQLConnectInfoPort :: NetworkSocket.PortNumber -> MySQLConnectInfo -> MySQLConnectInfo+setMySQLConnectInfoPort port (MySQLConnectInfo ci) = MySQLConnectInfo $ ci { MySQL.ciPort = port }++-- | Update character set for @MySQLConnectInfo@.+setMySQLConnectInfoCharset+  :: Word.Word8       -- ^ Numeric ID of collation. See https://dev.mysql.com/doc/refman/5.7/en/show-collation.html.+  -> MySQLConnectInfo -- ^ Reference connectInfo to perform update on+  -> MySQLConnectInfo+setMySQLConnectInfoCharset charset (MySQLConnectInfo ci) = MySQLConnectInfo $ ci { MySQL.ciCharset = charset }  -- TODO: submit a PR to mysql-haskell to add SHOW instance deriving instance Show MySQL.ConnectInfo
README.md view
@@ -43,7 +43,18 @@     -             , connectDatabase = "test"     -             }     + connectInfo = mkMySQLConnectInfo "localhost" "test" "test" "test"++    connectInfoNewPort :: MySQLConnectInfo+    - connectInfoNewPort = connectInfo { connectPort = 3307 }+    + connectInfoNewPort = setMySQLConnectInfoPort 3307 connectInfo++    connectInfoNewCharSet :: MySQLConnectInfo+    - connectInfoNewCharSet = connectInfo { connectOptions = [CharsetName "utf8"] }+    + connectInfoNewCharSet = setMySQLConnectInfoCharset 33 connectInfo+     ```++Aside from connection configuration, persistent-mysql-haskell is functionally on par with persistent-mysql (as of writing this). This can be seen by [comparing persistent-test between this fork and upstream](https://github.com/yesodweb/persistent/compare/master...naushadh:persistent-mysql-haskell#diff-028f5df7b2b9c5c8b0fa670fc8c69bff).  ### FAQs 
persistent-mysql-haskell.cabal view
@@ -1,12 +1,11 @@ name:            persistent-mysql-haskell-version:         0.1.1.0+version:         0.2.0.0 license:         MIT license-file:    LICENSE author:          Naushadh <naushadh@protonmail.com>, Felipe Lessa <felipe.lessa@gmail.com>, Michael Snoyman maintainer:      Naushadh <naushadh@protonmail.com> synopsis:        A pure haskell backend for the persistent library using MySQL database server. category:        Database, Yesod-stability:       Stable cabal-version:   >= 1.8 build-type:      Simple homepage:        http://www.yesodweb.com/book/persistent@@ -42,7 +41,7 @@                    , mysql-haskell         >= 0.8.0.0 && < 1.0                    , io-streams            >= 1.2     && < 2.0                    , time                  >= 1.5.0-                   , tls                   >= 1.3.5   && <1.4+                   , network               >= 2.3     && <3.0     exposed-modules: Database.Persist.MySQL     ghc-options:     -Wall