persistent-migration-0.3.0: Manual migrations for the persistent library
MaintainerBrandon Chinn <brandonchinn178@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Database.Persist.Migration.Utils.Sql

Description

Defines helper functions for writing SQL queries.

Synopsis

Documentation

commas :: Text -> [Text] Source #

Split the given line by commas, ignoring commas within parentheses.

commas "a,b,c" == ["a", "b", "c"]
commas "a,b,c (d,e),z" == ["a", "b", "c (d,e)", "z"]
commas "a,b,c (d,e,(f,g)),z" == ["a", "b", "c (d,e,(f,g))", "z"]

uncommas :: [Text] -> Text Source #

Join the given Text with commas separating each item.

uncommas' :: [Text] -> Text Source #

Join the given Text with commas separating each item and quoting them.

quote :: Text -> Text Source #

Quote the given Text.

data MigrateSql Source #

A SQL query (with placeholders) and values to replace those placeholders.

Constructors

MigrateSql 

Fields

Instances

Instances details
Show MigrateSql Source # 
Instance details

Defined in Database.Persist.Migration.Utils.Sql

executeSql :: MonadIO m => MigrateSql -> SqlPersistT m () Source #

Execute a SQL query.

pureSql :: Text -> MigrateSql Source #

Create a MigrateSql from the given Text.

mapSql :: (Text -> Text) -> MigrateSql -> MigrateSql Source #

Map the SQL text with the given function.

concatSql :: ([Text] -> Text) -> [MigrateSql] -> MigrateSql Source #

Concatenate the given MigrateSql queries with the given combining function.