-
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.
Merge pull request #28 from haskell-works/newhoggy/simplified-record-…
…decoding-2 New ToSqlParameters type class
- Loading branch information
Showing
4 changed files
with
38 additions
and
12 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
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
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 Data.RdsData.Encode.ToSqlParameters | ||
( ToSqlParameters(..) | ||
) where | ||
|
||
import Data.RdsData.Encode.Params | ||
import Data.RdsData.Types.Param | ||
|
||
import qualified Amazonka.RDSData as AWS | ||
|
||
class ToSqlParameters a where | ||
toSqlParameters :: a -> [AWS.SqlParameter] | ||
|
||
instance ToSqlParameters [AWS.SqlParameter] where | ||
toSqlParameters = id | ||
|
||
instance ToSqlParameters EncodedParams where | ||
toSqlParameters encodedParams = | ||
fmap toSqlParameter (encodedParams.run []) |
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 Data.RdsData.Types.EncodedParams | ||
( EncodedParams(..) | ||
) where | ||
|
||
import Data.RdsData.Types.Param | ||
|
||
newtype EncodedParams = EncodedParams | ||
{ run :: [Param] -> [Param] | ||
} | ||
|
||
instance Semigroup EncodedParams where | ||
EncodedParams f <> EncodedParams g = | ||
EncodedParams (f . g) | ||
|
||
instance Monoid EncodedParams where | ||
mempty = | ||
EncodedParams id |