packages feed

tsvsql 0.1.1.0 → 0.2.0.0

raw patch · 4 files changed

+15/−6 lines, 4 filesdep +string-qq

Dependencies added: string-qq

Files

Main.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings, ScopedTypeVariables#-}+{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, QuasiQuotes #-} module Main where import Data.Monoid import qualified Data.Map.Strict as M@@ -14,6 +14,7 @@ import Data.Attoparsec.Text  import System.Environment (getArgs) import qualified Options.Applicative as O+import Data.String.QQ  data Options = Options {         template :: Template@@ -30,8 +31,8 @@  opts = O.info (O.helper <*> parseOpts)           (O.fullDesc -          <> O.progDesc "Inject TSV into SQL template strings" -          <> O.header "tsvsql 0.1.1.0")+          <> O.progDesc [s|Inject TSV into SQL template strings|]+          <> O.header "tsvsql 0.2.0.0")  main = do   Options tmpl <- O.execParser opts@@ -61,6 +62,8 @@                                       | otherwise         = (vs !! idx) evalChunk vs (Placeholder idx Bool) | (vs !! idx) == "t" = "true" evalChunk vs (Placeholder idx Bool) | (vs !! idx) == "f" = "false"+evalChunk vs (Placeholder idx Bool) | (vs !! idx) == "1" = "true"+evalChunk vs (Placeholder idx Bool) | (vs !! idx) == "0" = "false"  wrapQuote x = T.singleton '\'' <> (escapeText x) <> T.singleton '\'' 
README view
@@ -24,12 +24,11 @@ INSERT into fruits (name, price) VALUES ('apple', 1); INSERT into fruits (name, price) VALUES ('banana', NULL); - The subtitution placeholders are like this:      $1      # value is a string; the value is quoted and escaped     $2:num  # value is a number; not quoted-    $3:bool # value is a bool; "t" is true, "f" is false+    $3:bool # value is a bool; "t" and "1" are true, "f" and "0" are false  The placeholders start counting the first TSV value from position 1, not zero.
+ stack.yaml view
@@ -0,0 +1,6 @@+flags: {}+packages:+- '.'+extra-deps: +- string-qq-0.0.2+resolver: lts-2.16
tsvsql.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                tsvsql-version:             0.1.1.0+version:             0.2.0.0 synopsis:            Template tsv into SQL -- description:          homepage:            https://github.com/danchoi/tsvsql@@ -27,5 +27,6 @@                      , bytestring                       , optparse-applicative                      , attoparsec+                     , string-qq    -- hs-source-dirs:         default-language:    Haskell2010