-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | FFI-like bindings for PostgreSQL stored functions -- -- For tutorial see here: -- https://github.com/zohl/postgresql-simple-bind/blob/master/README.md @package postgresql-simple-bind @version 0.4.0 -- | An algebraic data type that (partially) represents function -- declaration based on PostgreSQL documentation. module Database.PostgreSQL.Simple.Bind.Representation -- | Representation of a PostrgeSQL function signature (schema, name, -- arguments, result). data PGFunction PGFunction :: String -> String -> [PGArgument] -> PGResult -> PGFunction [pgfSchema] :: PGFunction -> String [pgfName] :: PGFunction -> String [pgfArguments] :: PGFunction -> [PGArgument] [pgfResult] :: PGFunction -> PGResult -- | Representation of a function's argument. data PGArgument PGArgument :: String -> String -> Bool -> PGArgument [pgaName] :: PGArgument -> String [pgaType] :: PGArgument -> String [pgaOptional] :: PGArgument -> Bool -- | Representation of a resultant's column (name, type). data PGColumn PGColumn :: String -> String -> PGColumn [pgcName] :: PGColumn -> String [pgcType] :: PGColumn -> String -- | Representation of a function's return value. data PGResult PGSingle :: String -> PGResult PGSetOf :: String -> PGResult PGTable :: [PGColumn] -> PGResult -- | The exception is thrown when something goes wrong with this package. data PostgresBindException -- | Thrown when parser fails to process a function declaration. Arguments -- of the constructor: error message from the parser. ParserFailed :: String -> PostgresBindException -- | Thrown when Argument expected to have default value while it -- doesn't. Actually this should never happen, but we all know... DefaultValueNotFound :: String -> PostgresBindException -- | Thrown when Argument is beign printed, but representation -- was't provided. Again, this should never happen. RepresentationNotFound :: String -> PostgresBindException -- | Takes PostgreSQL function signature and represent it as an algebraic -- data type. parsePGFunction :: (MonadThrow m) => Text -> m PGFunction instance GHC.Classes.Eq Database.PostgreSQL.Simple.Bind.Representation.PGFunction instance GHC.Show.Show Database.PostgreSQL.Simple.Bind.Representation.PGFunction instance GHC.Classes.Eq Database.PostgreSQL.Simple.Bind.Representation.PGResult instance GHC.Show.Show Database.PostgreSQL.Simple.Bind.Representation.PGResult instance GHC.Classes.Eq Database.PostgreSQL.Simple.Bind.Representation.PGColumn instance GHC.Show.Show Database.PostgreSQL.Simple.Bind.Representation.PGColumn instance GHC.Classes.Eq Database.PostgreSQL.Simple.Bind.Representation.PGArgument instance GHC.Show.Show Database.PostgreSQL.Simple.Bind.Representation.PGArgument instance GHC.Show.Show Database.PostgreSQL.Simple.Bind.Representation.PostgresBindException instance GHC.Classes.Eq Database.PostgreSQL.Simple.Bind.Representation.PostgresBindException instance GHC.Exception.Exception Database.PostgreSQL.Simple.Bind.Representation.PostgresBindException -- | Common functions and types. module Database.PostgreSQL.Simple.Bind.Common -- | Remove list and Only constructors. unwrapRow :: [Only a] -> a -- | Remove Only constructor. unwrapColumn :: [Only a] -> [a] -- | Options that specify how to construct the function binding. data PostgresBindOptions PostgresBindOptions :: (PGFunction -> String) -> (String -> String -> Bool) -> (String -> ReturnType) -> Bool -> Bool -> Bool -> PostgresBindOptions -- | Function that generates name of a binding. [pboFunctionName] :: PostgresBindOptions -> PGFunction -> String -- | Which columns in returned tables can be null. [pboIsNullable] :: PostgresBindOptions -> String -> String -> Bool -- | How to process type in "setof" clause. [pboSetOfReturnType] :: PostgresBindOptions -> String -> ReturnType -- | Whether to add explicit type casts to arguments. [pboExplicitCasts] :: PostgresBindOptions -> Bool -- | Whether to use old-style call syntax (:=) instead of (=>). This is -- necessary for PostgreSQL < 9.5. [pboOlderCallSyntax] :: PostgresBindOptions -> Bool -- | Whether to print executed queries and their arguments. [pboDebugQueries] :: PostgresBindOptions -> Bool -- | How to interpret results of function execution. data ReturnType AsRow :: ReturnType AsField :: ReturnType instance Data.Default.Class.Default Database.PostgreSQL.Simple.Bind.Common.PostgresBindOptions -- | Misc auxiliary functions. module Database.PostgreSQL.Simple.Bind.Utils -- | Fetch function declaration(s) from database. getFunctionDeclaration :: Connection -> String -> IO [String] -- | Generate module with bindings. generateBindingsModule :: Connection -> String -> String -> [String] -> IO String -- | Default instances for PostgresType family. module Database.PostgreSQL.Simple.Bind.Types -- | Mapping from PostgreSQL types to Haskell types. -- |

Description

-- -- postgresql-simple-bind is an extension for postgresql-simple library -- that faciliates and automates bindings creation. This is especially -- useful in a design pattern where an application communicates with a -- database via API hiding the internal structure of the latter. module Database.PostgreSQL.Simple.Bind -- | Function that constructs binding for PostgreSQL stored function by -- it's signature. bindFunction :: PostgresBindOptions -> Text -> Q [Dec] -- | Options that specify how to construct the function binding. data PostgresBindOptions PostgresBindOptions :: (PGFunction -> String) -> (String -> String -> Bool) -> (String -> ReturnType) -> Bool -> Bool -> Bool -> PostgresBindOptions -- | Function that generates name of a binding. [pboFunctionName] :: PostgresBindOptions -> PGFunction -> String -- | Which columns in returned tables can be null. [pboIsNullable] :: PostgresBindOptions -> String -> String -> Bool -- | How to process type in "setof" clause. [pboSetOfReturnType] :: PostgresBindOptions -> String -> ReturnType -- | Whether to add explicit type casts to arguments. [pboExplicitCasts] :: PostgresBindOptions -> Bool -- | Whether to use old-style call syntax (:=) instead of (=>). This is -- necessary for PostgreSQL < 9.5. [pboOlderCallSyntax] :: PostgresBindOptions -> Bool -- | Whether to print executed queries and their arguments. [pboDebugQueries] :: PostgresBindOptions -> Bool -- | How to interpret results of function execution. data ReturnType AsRow :: ReturnType AsField :: ReturnType -- | The exception is thrown when something goes wrong with this package. data PostgresBindException -- | Thrown when parser fails to process a function declaration. Arguments -- of the constructor: error message from the parser. ParserFailed :: String -> PostgresBindException -- | Thrown when Argument expected to have default value while it -- doesn't. Actually this should never happen, but we all know... DefaultValueNotFound :: String -> PostgresBindException -- | Thrown when Argument is beign printed, but representation -- was't provided. Again, this should never happen. RepresentationNotFound :: String -> PostgresBindException -- | Mapping from PostgreSQL types to Haskell types. -- | Representation of a PostrgeSQL function signature (schema, name, -- arguments, result). data PGFunction PGFunction :: String -> String -> [PGArgument] -> PGResult -> PGFunction [pgfSchema] :: PGFunction -> String [pgfName] :: PGFunction -> String [pgfArguments] :: PGFunction -> [PGArgument] [pgfResult] :: PGFunction -> PGResult -- | Representation of a function's argument. data PGArgument PGArgument :: String -> String -> Bool -> PGArgument [pgaName] :: PGArgument -> String [pgaType] :: PGArgument -> String [pgaOptional] :: PGArgument -> Bool -- | Representation of a resultant's column (name, type). data PGColumn PGColumn :: String -> String -> PGColumn [pgcName] :: PGColumn -> String [pgcType] :: PGColumn -> String -- | Representation of a function's return value. data PGResult PGSingle :: String -> PGResult PGSetOf :: String -> PGResult PGTable :: [PGColumn] -> PGResult