-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Interpreter for SQL-structure definitions in YAML (YamSql) -- -- Interpreter for SQL-structure definitions in YAML (YamSql) @package hamsql @version 0.9.0.0 module Database.HamSql.Internal.Option boolFlag :: Mod FlagFields Bool -> Parser Bool val :: (HasMetavar f, HasValue f) => String -> Mod f String parserInfoHamsql :: ParserInfo Command data Command Install :: OptCommon -> OptCommonDb -> OptInstall -> Command Upgrade :: OptCommon -> OptCommonDb -> Command Doc :: OptCommon -> OptDoc -> Command NoCommand :: OptNoCommand -> Command parserCommand :: Parser Command parserCmdInstall :: Parser Command parserCmdUpgrade :: Parser Command parserCmdDoc :: Parser Command data OptCommon OptCommon :: FilePath -> Bool -> Bool -> OptCommon [optSetup] :: OptCommon -> FilePath [optVerbose] :: OptCommon -> Bool [optDebug] :: OptCommon -> Bool parserOptCommon :: Parser OptCommon data OptCommonDb OptCommonDb :: Bool -> Bool -> String -> Bool -> Maybe FilePath -> Bool -> OptCommonDb [optEmulate] :: OptCommonDb -> Bool [optPrint] :: OptCommonDb -> Bool [optConnection] :: OptCommonDb -> String [optPermitDataDeletion] :: OptCommonDb -> Bool [optSqlLog] :: OptCommonDb -> Maybe FilePath [optSqlLogHideRollbacks] :: OptCommonDb -> Bool justStr :: ReadM (Maybe String) parserOptCommonDb :: Parser OptCommonDb data OptInstall OptInstall :: Bool -> Bool -> OptInstall [optDeleteExistingDatabase] :: OptInstall -> Bool [optDeleteResidualRoles] :: OptInstall -> Bool parserOptInstall :: Parser OptInstall data OptNoCommand OptNoCommand :: Bool -> OptNoCommand [optVersion] :: OptNoCommand -> Bool parserOptNoCommand :: Parser Command data OptDoc OptDoc :: FilePath -> FilePath -> OptDoc [optOutputDir] :: OptDoc -> FilePath [optTemplate] :: OptDoc -> FilePath parserOptDoc :: Parser OptDoc instance GHC.Show.Show Database.HamSql.Internal.Option.Command instance GHC.Show.Show Database.HamSql.Internal.Option.OptDoc instance GHC.Show.Show Database.HamSql.Internal.Option.OptNoCommand instance GHC.Show.Show Database.HamSql.Internal.Option.OptInstall instance GHC.Show.Show Database.HamSql.Internal.Option.OptCommonDb instance GHC.Show.Show Database.HamSql.Internal.Option.OptCommon module Database.HamSql.Internal.Utils join :: [a] -> [[a]] -> [a] err :: Text -> a warn :: Text -> a -> a warn' :: Text -> IO () msg :: Text -> Text -> a -> a msg' :: Text -> Text -> IO () info :: OptCommon -> Text -> a -> a debug :: OptCommon -> Text -> a -> a removeDuplicates :: (Ord a) => [a] -> [a] maybeMap :: (a -> b) -> Maybe [a] -> [b] maybePrefix :: Text -> Maybe Text -> Text -- | Joins two Maybe lists maybeJoin :: Maybe [a] -> Maybe [a] -> Maybe [a] -- | Takes the right value, if Just there maybeRight :: Maybe a -> Maybe a -> Maybe a fromJustReason :: Text -> Maybe a -> a selectUniqueReason :: Text -> [a] -> a tshow :: (Show a) => a -> Text showCode :: Text -> Text maybeHead :: [a] -> Maybe a tr :: Show a => a -> a isIn :: Char -> Text -> Bool (<->) :: Text -> Text -> Text (<\>) :: Text -> Text -> Text -- | A space efficient, packed, unboxed Unicode text type. data Text :: * -- | An infix synonym for mappend. (<>) :: Monoid m => m -> m -> m infixr 6 <> module Database.YamSql.Parser removeFirstPart :: String -> String snakeify :: String -> String myOpt :: Options outJson :: ToJSON a => a -> String forceToJson :: ToJSON a => a -> IO () parseYamSql :: (Generic r, GFromJSON Zero (Rep r), Data r) => Value -> Parser r toYamSqlJson :: (Generic a, GToJSON Zero (Rep a)) => a -> Value data YamsqlException YamsqlException :: Text -> YamsqlException -- | A configurable generic JSON decoder. This function applied to -- defaultOptions is used as the default for parseJSON when -- the type is an instance of Generic. genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a -- | A configurable generic JSON creator. This function applied to -- defaultOptions is used as the default for toJSON when -- the type is an instance of Generic. genericToJSON :: (Generic a, GToJSON Zero (Rep a)) => Options -> a -> Value -- | A type that can be converted to JSON. -- -- An example type and instance: -- --
-- -- Allow ourselves to write Text literals.
-- {-# LANGUAGE OverloadedStrings #-}
--
-- data Coord = Coord { x :: Double, y :: Double }
--
-- instance ToJSON Coord where
-- toJSON (Coord x y) = object ["x" .= x, "y" .= y]
--
-- toEncoding (Coord x y) = pairs ("x" .= x <> "y" .= y)
--
--
-- Instead of manually writing your ToJSON instance, there are two
-- options to do it automatically:
--
--
-- {-# LANGUAGE DeriveGeneric #-}
--
-- import GHC.Generics
--
-- data Coord = Coord { x :: Double, y :: Double } deriving Generic
--
-- instance ToJSON Coord where
-- toEncoding = genericToEncoding defaultOptions
--
--
-- Why do we provide an implementation for toEncoding here? The
-- toEncoding function is a relatively new addition to this class.
-- To allow users of older versions of this library to upgrade without
-- having to edit all of their instances or encounter surprising
-- incompatibilities, the default implementation of toEncoding
-- uses toJSON. This produces correct results, but since it
-- performs an intermediate conversion to a Value, it will be less
-- efficient than directly emitting an Encoding. Our one-liner
-- definition of toEncoding above bypasses the intermediate
-- Value.
--
-- If DefaultSignatures doesn't give exactly the results you
-- want, you can customize the generic encoding with only a tiny amount
-- of effort, using genericToJSON and genericToEncoding
-- with your preferred Options:
--
-- -- instance ToJSON Coord where -- toJSON = genericToJSON defaultOptions -- toEncoding = genericToEncoding defaultOptions --class ToJSON a -- | Convert a Haskell value to a JSON-friendly intermediate type. toJSON :: ToJSON a => a -> Value -- | Encode a Haskell value as JSON. -- -- The default implementation of this method creates an intermediate -- Value using toJSON. This provides source-level -- compatibility for people upgrading from older versions of this -- library, but obviously offers no performance advantage. -- -- To benefit from direct encoding, you must provide an -- implementation for this method. The easiest way to do so is by having -- your types implement Generic using the DeriveGeneric -- extension, and then have GHC generate a method body as follows. -- --
-- instance ToJSON Coord where -- toEncoding = genericToEncoding defaultOptions --toEncoding :: ToJSON a => a -> Encoding toJSONList :: ToJSON a => [a] -> Value toEncodingList :: ToJSON a => [a] -> Encoding -- | A type that can be converted from JSON, with the possibility of -- failure. -- -- In many cases, you can get the compiler to generate parsing code for -- you (see below). To begin, let's cover writing an instance by hand. -- -- There are various reasons a conversion could fail. For example, an -- Object could be missing a required key, an Array could -- be of the wrong size, or a value could be of an incompatible type. -- -- The basic ways to signal a failed conversion are as follows: -- --
-- -- Allow ourselves to write Text literals.
-- {-# LANGUAGE OverloadedStrings #-}
--
-- data Coord = Coord { x :: Double, y :: Double }
--
-- instance FromJSON Coord where
-- parseJSON (Object v) = Coord <$>
-- v .: "x" <*>
-- v .: "y"
--
-- -- We do not expect a non-Object value here.
-- -- We could use mzero to fail, but typeMismatch
-- -- gives a much more informative error message.
-- parseJSON invalid = typeMismatch "Coord" invalid
--
--
-- Instead of manually writing your FromJSON instance, there are
-- two options to do it automatically:
--
--
-- {-# LANGUAGE DeriveGeneric #-}
--
-- import GHC.Generics
--
-- data Coord = Coord { x :: Double, y :: Double } deriving Generic
--
-- instance FromJSON Coord
--
--
-- If DefaultSignatures doesn't give exactly the results you
-- want, you can customize the generic decoding with only a tiny amount
-- of effort, using genericParseJSON with your preferred
-- Options:
--
-- -- instance FromJSON Coord where -- parseJSON = genericParseJSON defaultOptions --class FromJSON a parseJSON :: FromJSON a => Value -> Parser a parseJSONList :: FromJSON a => Value -> Parser [a] -- | Representable types of kind *. This class is derivable in GHC with the -- DeriveGeneric flag on. class Generic a where type Rep a :: * -> * where { type family Rep a :: * -> *; } -- | Convert from the datatype to its representation from :: Generic a => a -> Rep a x -- | Convert from the representation to the datatype to :: Generic a => Rep a x -> a -- | The Data class comprehends a fundamental primitive -- gfoldl for folding over constructor applications, say terms. -- This primitive can be instantiated in several ways to map over the -- immediate subterms of a term; see the gmap combinators later -- in this class. Indeed, a generic programmer does not necessarily need -- to use the ingenious gfoldl primitive but rather the intuitive -- gmap combinators. The gfoldl primitive is completed by -- means to query top-level constructors, to turn constructor -- representations into proper terms, and to list all possible datatype -- constructors. This completion allows us to serve generic programming -- scenarios like read, show, equality, term generation. -- -- The combinators gmapT, gmapQ, gmapM, etc are all -- provided with default definitions in terms of gfoldl, leaving -- open the opportunity to provide datatype-specific definitions. (The -- inclusion of the gmap combinators as members of class -- Data allows the programmer or the compiler to derive -- specialised, and maybe more efficient code per datatype. Note: -- gfoldl is more higher-order than the gmap combinators. -- This is subject to ongoing benchmarking experiments. It might turn out -- that the gmap combinators will be moved out of the class -- Data.) -- -- Conceptually, the definition of the gmap combinators in terms -- of the primitive gfoldl requires the identification of the -- gfoldl function arguments. Technically, we also need to -- identify the type constructor c for the construction of the -- result type from the folded term type. -- -- In the definition of gmapQx combinators, we use -- phantom type constructors for the c in the type of -- gfoldl because the result type of a query does not involve the -- (polymorphic) type of the term argument. In the definition of -- gmapQl we simply use the plain constant type constructor -- because gfoldl is left-associative anyway and so it is readily -- suited to fold a left-associative binary operation over the immediate -- subterms. In the definition of gmapQr, extra effort is needed. We use -- a higher-order accumulation trick to mediate between left-associative -- constructor application vs. right-associative binary operation (e.g., -- (:)). When the query is meant to compute a value of type -- r, then the result type withing generic folding is r -- -> r. So the result of folding is a function to which we -- finally pass the right unit. -- -- With the -XDeriveDataTypeable option, GHC can generate -- instances of the Data class automatically. For example, given -- the declaration -- --
-- data T a b = C1 a b | C2 deriving (Typeable, Data) ---- -- GHC will generate an instance that is equivalent to -- --
-- instance (Data a, Data b) => Data (T a b) where -- gfoldl k z (C1 a b) = z C1 `k` a `k` b -- gfoldl k z C2 = z C2 -- -- gunfold k z c = case constrIndex c of -- 1 -> k (k (z C1)) -- 2 -> z C2 -- -- toConstr (C1 _ _) = con_C1 -- toConstr C2 = con_C2 -- -- dataTypeOf _ = ty_T -- -- con_C1 = mkConstr ty_T "C1" [] Prefix -- con_C2 = mkConstr ty_T "C2" [] Prefix -- ty_T = mkDataType "Module.T" [con_C1, con_C2] ---- -- This is suitable for datatypes that are exported transparently. class Typeable * a => Data a -- | Left-associative fold operation for constructor applications. -- -- The type of gfoldl is a headache, but operationally it is a -- simple generalisation of a list fold. -- -- The default definition for gfoldl is const -- id, which is suitable for abstract datatypes with no -- substructures. gfoldl :: Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a -- | Unfolding constructor applications gunfold :: Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a -- | Obtaining the constructor from a given datum. For proper terms, this -- is meant to be the top-level constructor. Primitive datatypes are here -- viewed as potentially infinite sets of values (i.e., constructors). toConstr :: Data a => a -> Constr -- | The outer type constructor of the type dataTypeOf :: Data a => a -> DataType -- | Mediate types and unary type constructors. In Data instances of -- the form T a, dataCast1 should be defined as -- gcast1. -- -- The default definition is const Nothing, which -- is appropriate for non-unary type constructors. dataCast1 :: (Data a, Typeable (* -> *) t) => (forall d. Data d => c (t d)) -> Maybe (c a) -- | Mediate types and binary type constructors. In Data instances -- of the form T a b, dataCast2 should be defined as -- gcast2. -- -- The default definition is const Nothing, which -- is appropriate for non-binary type constructors. dataCast2 :: (Data a, Typeable (* -> * -> *) t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a) -- | A generic transformation that maps over the immediate subterms -- -- The default definition instantiates the type constructor c in -- the type of gfoldl to an identity datatype constructor, using -- the isomorphism pair as injection and projection. gmapT :: Data a => (forall b. Data b => b -> b) -> a -> a -- | A generic query with a left-associative binary operator gmapQl :: Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r -- | A generic query with a right-associative binary operator gmapQr :: Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r -- | A generic query that processes the immediate subterms and returns a -- list of results. The list is given in the same order as originally -- specified in the declaration of the data constructors. gmapQ :: Data a => (forall d. Data d => d -> u) -> a -> [u] -- | A generic query that processes one child by index (zero-based) gmapQi :: Data a => Int -> (forall d. Data d => d -> u) -> a -> u -- | A generic monadic transformation that maps over the immediate subterms -- -- The default definition instantiates the type constructor c in -- the type of gfoldl to the monad datatype constructor, defining -- injection and projection using return and >>=. gmapM :: (Data a, Monad m) => (forall d. Data d => d -> m d) -> a -> m a -- | Transformation of at least one immediate subterm does not fail gmapMp :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a -- | Transformation of one immediate subterm with success gmapMo :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a instance GHC.Show.Show Database.YamSql.Parser.YamsqlException instance GHC.Exception.Exception Database.YamSql.Parser.YamsqlException module Database.YamSql.Internal.SqlId -- | Idable class Show a => ToSqlId a where sqlIdCode = toSqlCode . sqlId sqlId :: ToSqlId a => a -> SqlId sqlIdCode :: ToSqlId a => a -> Text class (Typeable a, ToSqlCode a, Eq a, Show a) => SqlIdContent a -- | SqlId data SqlId [SqlId] :: (SqlObjType a, SqlIdContent b) => SqlObj a b -> SqlId sqlIdShowType :: SqlId -> Text sqlIdTypeCode :: SqlId -> Text data SqlContext a SqlContext :: a -> SqlContext a class (Typeable a, ToSqlCode a, Show a) => SqlObjType a data SqlObj a b [SqlObj] :: (SqlObjType a, SqlIdContent b) => {sqlObjType :: a, sqlObjId :: b} -> SqlObj a b unsafePlainName :: SqlName -> Text (<.>) :: SqlName -> SqlName -> SqlName expSqlName :: SqlName -> [SqlName] contSqlName :: [SqlName] -> SqlName toSqlCode' :: [SqlName] -> Text class ToSqlCode a toSqlCode :: ToSqlCode a => a -> Text class ToSqlName a toSqlName :: ToSqlName a => a -> SqlName class SqlIdentifierConcat a (//) :: SqlIdentifierConcat a => a -> a -> a newtype SqlName SqlName :: Text -> SqlName newtype SqlType SqlType :: Text -> SqlType instance Data.Data.Data Database.YamSql.Internal.SqlId.SqlType instance GHC.Classes.Eq Database.YamSql.Internal.SqlId.SqlType instance GHC.Show.Show Database.YamSql.Internal.SqlId.SqlType instance GHC.Generics.Generic Database.YamSql.Internal.SqlId.SqlType instance Data.Data.Data Database.YamSql.Internal.SqlId.SqlName instance GHC.Show.Show Database.YamSql.Internal.SqlId.SqlName instance GHC.Classes.Ord Database.YamSql.Internal.SqlId.SqlName instance GHC.Generics.Generic Database.YamSql.Internal.SqlId.SqlName instance GHC.Show.Show Database.YamSql.Internal.SqlId.SqlId instance GHC.Show.Show (Database.YamSql.Internal.SqlId.SqlObj a b) instance GHC.Classes.Eq Database.YamSql.Internal.SqlId.SqlId instance GHC.Classes.Ord Database.YamSql.Internal.SqlId.SqlId instance Database.YamSql.Internal.SqlId.ToSqlId Database.YamSql.Internal.SqlId.SqlId instance Database.YamSql.Internal.SqlId.ToSqlCode Database.YamSql.Internal.SqlId.SqlId instance GHC.Show.Show (Database.YamSql.Internal.SqlId.SqlContext a) instance (Database.YamSql.Internal.SqlId.SqlObjType a, Database.YamSql.Internal.SqlId.SqlIdContent b) => Database.YamSql.Internal.SqlId.ToSqlId (Database.YamSql.Internal.SqlId.SqlObj a b) instance GHC.Classes.Eq (Database.YamSql.Internal.SqlId.SqlObj a b) instance Database.YamSql.Internal.SqlId.ToSqlCode (Database.YamSql.Internal.SqlId.SqlObj a b) instance Database.YamSql.Internal.SqlId.SqlIdContent Database.YamSql.Internal.SqlId.SqlName instance Database.YamSql.Internal.SqlId.SqlIdContent (Database.YamSql.Internal.SqlId.SqlName, Database.YamSql.Internal.SqlId.SqlName) instance Database.YamSql.Internal.SqlId.ToSqlCode (Database.YamSql.Internal.SqlId.SqlName, Database.YamSql.Internal.SqlId.SqlName) instance Database.YamSql.Internal.SqlId.SqlIdContent (Database.YamSql.Internal.SqlId.SqlName, [Database.YamSql.Internal.SqlId.SqlType]) instance Database.YamSql.Internal.SqlId.ToSqlCode (Database.YamSql.Internal.SqlId.SqlName, [Database.YamSql.Internal.SqlId.SqlType]) instance Database.YamSql.Internal.SqlId.SqlIdContent (Database.YamSql.Internal.SqlId.SqlName, Database.YamSql.Internal.SqlId.SqlName, Database.YamSql.Internal.SqlId.SqlName) instance Database.YamSql.Internal.SqlId.ToSqlCode (Database.YamSql.Internal.SqlId.SqlName, Database.YamSql.Internal.SqlId.SqlName, Database.YamSql.Internal.SqlId.SqlName) instance GHC.Classes.Eq Database.YamSql.Internal.SqlId.SqlName instance Database.YamSql.Internal.SqlId.ToSqlCode Database.YamSql.Internal.SqlId.SqlName instance Database.YamSql.Internal.SqlId.SqlIdentifierConcat Database.YamSql.Internal.SqlId.SqlName instance Database.YamSql.Internal.SqlId.ToSqlCode Database.YamSql.Internal.SqlId.SqlType instance Database.YamSql.Internal.SqlId.SqlIdentifierConcat Database.YamSql.Internal.SqlId.SqlType instance GHC.Base.Monoid Database.YamSql.Internal.SqlId.SqlName instance Data.Aeson.Types.FromJSON.FromJSON Database.YamSql.Internal.SqlId.SqlName instance Data.Aeson.Types.ToJSON.ToJSON Database.YamSql.Internal.SqlId.SqlName instance Data.Aeson.Types.FromJSON.FromJSON Database.YamSql.Internal.SqlId.SqlType instance Data.Aeson.Types.ToJSON.ToJSON Database.YamSql.Internal.SqlId.SqlType module Database.YamSql.Internal.Basic module Database.YamSql.Internal.Commons data Variable Variable :: SqlName -> Maybe Text -> SqlType -> Maybe Text -> Variable [variableName] :: Variable -> SqlName [variableDescription] :: Variable -> Maybe Text [variableType] :: Variable -> SqlType [variableDefault] :: Variable -> Maybe Text data Parameter Parameter :: SqlName -> Maybe Text -> SqlType -> Parameter [parameterName] :: Parameter -> SqlName [parameterDescription] :: Parameter -> Maybe Text [parameterType] :: Parameter -> SqlType instance Data.Data.Data Database.YamSql.Internal.Commons.Parameter instance GHC.Show.Show Database.YamSql.Internal.Commons.Parameter instance GHC.Generics.Generic Database.YamSql.Internal.Commons.Parameter instance Data.Data.Data Database.YamSql.Internal.Commons.Variable instance GHC.Show.Show Database.YamSql.Internal.Commons.Variable instance GHC.Generics.Generic Database.YamSql.Internal.Commons.Variable instance Data.Aeson.Types.FromJSON.FromJSON Database.YamSql.Internal.Commons.Variable instance Data.Aeson.Types.ToJSON.ToJSON Database.YamSql.Internal.Commons.Variable instance Data.Aeson.Types.FromJSON.FromJSON Database.YamSql.Internal.Commons.Parameter instance Data.Aeson.Types.ToJSON.ToJSON Database.YamSql.Internal.Commons.Parameter module Database.YamSql data Schema Schema :: SqlName -> Text -> Maybe [SqlName] -> Maybe [Function] -> Maybe [FunctionTpl] -> Maybe [Table] -> Maybe [TableTpl] -> Maybe [Role] -> Maybe [Sequence] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [Domain] -> Maybe [Type] -> Maybe Text -> Maybe Text -> Schema [schemaName] :: Schema -> SqlName [schemaDescription] :: Schema -> Text [schemaDependencies] :: Schema -> Maybe [SqlName] [schemaFunctions] :: Schema -> Maybe [Function] [schemaFunctionTemplates] :: Schema -> Maybe [FunctionTpl] [schemaTables] :: Schema -> Maybe [Table] [schemaTableTemplates] :: Schema -> Maybe [TableTpl] [schemaRoles] :: Schema -> Maybe [Role] [schemaSequences] :: Schema -> Maybe [Sequence] [schemaPrivUsage] :: Schema -> Maybe [SqlName] [schemaPrivSelectAll] :: Schema -> Maybe [SqlName] [schemaPrivInsertAll] :: Schema -> Maybe [SqlName] [schemaPrivUpdateAll] :: Schema -> Maybe [SqlName] [schemaPrivDeleteAll] :: Schema -> Maybe [SqlName] [schemaPrivSequenceAll] :: Schema -> Maybe [SqlName] [schemaPrivExecuteAll] :: Schema -> Maybe [SqlName] [schemaPrivAllAll] :: Schema -> Maybe [SqlName] [schemaDomains] :: Schema -> Maybe [Domain] [schemaTypes] :: Schema -> Maybe [Type] [schemaExecPostInstall] :: Schema -> Maybe Text [schemaExecPostInstallAndUpgrade] :: Schema -> Maybe Text data SQL_SCHEMA SQL_SCHEMA :: SQL_SCHEMA data Check Check :: SqlName -> Text -> Text -> Check [checkName] :: Check -> SqlName [checkDescription] :: Check -> Text [checkCheck] :: Check -> Text -- | Domains are aliases of an existing SQL types, possibly with checks data Domain Domain :: SqlName -> Text -> SqlType -> Maybe Text -> Maybe [Check] -> Domain [domainName] :: Domain -> SqlName [domainDescription] :: Domain -> Text [domainType] :: Domain -> SqlType [domainDefault] :: Domain -> Maybe Text [domainChecks] :: Domain -> Maybe [Check] data SQL_DOMAIN SQL_DOMAIN :: SQL_DOMAIN data SQL_DOMAIN_CONSTRAINT SQL_DOMAIN_CONSTRAINT :: SQL_DOMAIN_CONSTRAINT data Function Function :: SqlName -> Text -> SqlType -> Maybe [Variable] -> Maybe [SqlName] -> Maybe [FunctionTpl] -> Maybe [Parameter] -> Maybe [Variable] -> Maybe [SqlName] -> Maybe Bool -> Maybe SqlName -> Maybe Text -> Maybe Text -> Function [functionName] :: Function -> SqlName -- | description what the function is good for [functionDescription] :: Function -> Text -- | return type of the function, TABLE is special (see return_columns) [functionReturns] :: Function -> SqlType -- | parameters the function takes [functionParameters] :: Function -> Maybe [Variable] -- | list of templates, used for this function [functionTemplates] :: Function -> Maybe [SqlName] -- | loaded templates, not designed for use via Yaml -- -- TODO: move to xfunctionInternal [functionTemplateData] :: Function -> Maybe [FunctionTpl] -- | if return is TABLE, gives the columns that are returned (see -- parameter) [functionReturnsColumns] :: Function -> Maybe [Parameter] -- | variables that are defined (ignored if language is given) [functionVariables] :: Function -> Maybe [Variable] -- | Role that has the privilege to execute the function [functionPrivExecute] :: Function -> Maybe [SqlName] -- | If true, the function is executed with the privileges of the owner! | -- Owner has to be given, if this is true (not implemented yet!) [functionSecurityDefiner] :: Function -> Maybe Bool -- | owner of the function [functionOwner] :: Function -> Maybe SqlName -- | language in which the body is written if not defined, pgsql is assumed -- an variables must be defined via variables if pgsql is given -- explicitly, variables are your problem... [functionLanguage] :: Function -> Maybe Text -- | the code of the function (body) [functionBody] :: Function -> Maybe Text data SQL_FUNCTION SQL_FUNCTION :: SQL_FUNCTION data FunctionTpl FunctionTpl :: SqlName -> Text -> Maybe Text -> Maybe [Variable] -> Maybe [Variable] -> Maybe [SqlName] -> Maybe Bool -> Maybe SqlName -> Maybe Text -> Maybe Text -> FunctionTpl [functiontplTemplate] :: FunctionTpl -> SqlName [functiontplDescription] :: FunctionTpl -> Text [functiontplLanguage] :: FunctionTpl -> Maybe Text [functiontplParameters] :: FunctionTpl -> Maybe [Variable] [functiontplVariables] :: FunctionTpl -> Maybe [Variable] [functiontplPrivExecute] :: FunctionTpl -> Maybe [SqlName] [functiontplSecurityDefiner] :: FunctionTpl -> Maybe Bool [functiontplOwner] :: FunctionTpl -> Maybe SqlName [functiontplBodyPrelude] :: FunctionTpl -> Maybe Text [functiontplBodyPostlude] :: FunctionTpl -> Maybe Text applyFunctionTpl :: FunctionTpl -> Function -> Function data Role Role :: SqlName -> Text -> Maybe Bool -> Maybe Text -> Maybe [SqlName] -> Role [roleName] :: Role -> SqlName [roleDescription] :: Role -> Text [roleLogin] :: Role -> Maybe Bool [rolePassword] :: Role -> Maybe Text [roleMemberIn] :: Role -> Maybe [SqlName] data SQL_ROLE SQL_ROLE :: SQL_ROLE data SQL_ROLE_MEMBERSHIP SQL_ROLE_MEMBERSHIP :: SQL_ROLE_MEMBERSHIP data Sequence Sequence :: SqlName -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> Maybe Bool -> Maybe SqlName -> Sequence [sequenceName] :: Sequence -> SqlName [sequenceIncrement] :: Sequence -> Maybe Int [sequenceMinValue] :: Sequence -> Maybe Int [sequenceMaxValue] :: Sequence -> Maybe Int [sequenceStartValue] :: Sequence -> Maybe Int [sequenceCache] :: Sequence -> Maybe Int [sequenceCycle] :: Sequence -> Maybe Bool [sequenceOwnedByColumn] :: Sequence -> Maybe SqlName data SQL_SEQUENCE SQL_SEQUENCE :: SQL_SEQUENCE data Table Table :: SqlName -> Text -> [Column] -> [SqlName] -> Maybe [UniqueKey] -> Maybe [ForeignKey] -> Maybe [Check] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [TableTpl] -> Table [tableName] :: Table -> SqlName [tableDescription] :: Table -> Text [tableColumns] :: Table -> [Column] [tablePrimaryKey] :: Table -> [SqlName] [tableUnique] :: Table -> Maybe [UniqueKey] [tableForeignKeys] :: Table -> Maybe [ForeignKey] [tableChecks] :: Table -> Maybe [Check] [tableInherits] :: Table -> Maybe [SqlName] [tablePrivSelect] :: Table -> Maybe [SqlName] [tablePrivInsert] :: Table -> Maybe [SqlName] [tablePrivUpdate] :: Table -> Maybe [SqlName] [tablePrivDelete] :: Table -> Maybe [SqlName] [tableTemplates] :: Table -> Maybe [SqlName] [tableTemplateData] :: Table -> Maybe [TableTpl] data SQL_TABLE SQL_TABLE :: SQL_TABLE data TableTpl TableTpl :: SqlName -> Text -> Maybe [ForeignKey] -> Maybe [SqlName] -> Maybe [Column] -> Maybe [Check] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> Maybe [SqlName] -> TableTpl [tabletplTemplate] :: TableTpl -> SqlName [tabletplDescription] :: TableTpl -> Text [tabletplForeignKeys] :: TableTpl -> Maybe [ForeignKey] [tabletplInherits] :: TableTpl -> Maybe [SqlName] [tabletplColumns] :: TableTpl -> Maybe [Column] [tabletplChecks] :: TableTpl -> Maybe [Check] [tabletplPrivSelect] :: TableTpl -> Maybe [SqlName] [tabletplPrivInsert] :: TableTpl -> Maybe [SqlName] [tabletplPrivUpdate] :: TableTpl -> Maybe [SqlName] [tabletplPrivDelete] :: TableTpl -> Maybe [SqlName] data Column Column :: SqlName -> SqlType -> Text -> Maybe Text -> Maybe Bool -> Maybe SqlName -> Maybe Text -> Maybe Text -> Maybe Bool -> Maybe [Check] -> Column [columnName] :: Column -> SqlName [columnType] :: Column -> SqlType [columnDescription] :: Column -> Text [columnDefault] :: Column -> Maybe Text [columnNull] :: Column -> Maybe Bool [columnReferences] :: Column -> Maybe SqlName [columnOnRefDelete] :: Column -> Maybe Text [columnOnRefUpdate] :: Column -> Maybe Text [columnUnique] :: Column -> Maybe Bool [columnChecks] :: Column -> Maybe [Check] data SQL_COLUMN SQL_COLUMN :: SQL_COLUMN applyTableTpl :: TableTpl -> Table -> Table data UniqueKey UniqueKey :: SqlName -> [SqlName] -> UniqueKey [uniquekeyName] :: UniqueKey -> SqlName [uniquekeyColumns] :: UniqueKey -> [SqlName] data ForeignKey ForeignKey :: SqlName -> [SqlName] -> SqlName -> [SqlName] -> Maybe Text -> Maybe Text -> ForeignKey [foreignkeyName] :: ForeignKey -> SqlName [foreignkeyColumns] :: ForeignKey -> [SqlName] [foreignkeyRefTable] :: ForeignKey -> SqlName [foreignkeyRefColumns] :: ForeignKey -> [SqlName] [foreignkeyOnDelete] :: ForeignKey -> Maybe Text [foreignkeyOnUpdate] :: ForeignKey -> Maybe Text data SQL_TABLE_CONSTRAINT SQL_TABLE_CONSTRAINT :: SQL_TABLE_CONSTRAINT data Type Type :: SqlName -> Text -> [TypeElement] -> Type [typeName] :: Type -> SqlName [typeDescription] :: Type -> Text [typeElements] :: Type -> [TypeElement] data TypeElement TypeElement :: SqlName -> SqlType -> TypeElement [typeelementName] :: TypeElement -> SqlName [typeelementType] :: TypeElement -> SqlType data SQL_TYPE SQL_TYPE :: SQL_TYPE module Database.HamSql.Internal.Stmt data SqlStmtId SqlStmtId :: SqlStmtType -> SqlId -> SqlStmtId [stmtType] :: SqlStmtId -> SqlStmtType [stmtSqlId] :: SqlStmtId -> SqlId data SqlStmt SqlStmt :: SqlStmtId -> Text -> SqlStmt stmtId :: SqlStmt -> SqlStmtId stmtBody :: SqlStmt -> Text stmtIdType :: SqlStmt -> SqlStmtType stmtDesc :: SqlStmt -> Text newSqlStmtId :: (ToSqlId a) => SqlStmtType -> a -> SqlStmtId newSqlStmt :: (ToSqlId a) => SqlStmtType -> a -> Text -> Maybe SqlStmt sqlPrinter :: [SqlStmt] -> Text -- | More like always perform unfiltered after delete allowInUpgrade :: SqlStmt -> Bool stmtRequiresPermitDeletion :: SqlStmt -> Bool data SqlStmtType SqlDropDatabase :: SqlStmtType SqlCreateDatabase :: SqlStmtType SqlPre :: SqlStmtType SqlPreInstall :: SqlStmtType SqlRevokePrivilege :: SqlStmtType SqlRevokeMembership :: SqlStmtType SqlDropRole :: SqlStmtType SqlCreateRole :: SqlStmtType SqlAlterRole :: SqlStmtType SqlGrantMembership :: SqlStmtType SqlCreateSchema :: SqlStmtType SqlCreateDomain :: SqlStmtType SqlCreateType :: SqlStmtType SqlDropTableConstr :: SqlStmtType SqlDropDomainConstr :: SqlStmtType SqlDropSequence :: SqlStmtType SqlDropTableColumn :: SqlStmtType SqlDropTable :: SqlStmtType SqlDropFunction :: SqlStmtType SqlCreateSequence :: SqlStmtType SqlCreateTable :: SqlStmtType SqlAddColumn :: SqlStmtType SqlAlterTable :: SqlStmtType SqlDropColumnDefault :: SqlStmtType SqlAlterColumn :: SqlStmtType SqlAlterSequence :: SqlStmtType SqlDropDomain :: SqlStmtType SqlDropType :: SqlStmtType SqlCreateFunction :: SqlStmtType SqlInherit :: SqlStmtType SqlAddTableConstr :: SqlStmtType SqlCreatePrimaryKeyConstr :: SqlStmtType SqlCreateUniqueConstr :: SqlStmtType SqlCreateForeignKeyConstr :: SqlStmtType SqlCreateCheckConstr :: SqlStmtType SqlAddDefault :: SqlStmtType SqlCreateTrigger :: SqlStmtType SqlPriv :: SqlStmtType SqlComment :: SqlStmtType SqlUnclassified :: SqlStmtType SqlPostInstallAndUpgrade :: SqlStmtType SqlPostInstall :: SqlStmtType toSqlCodeString :: Text -> Text instance GHC.Show.Show Database.HamSql.Internal.Stmt.SqlStmt instance GHC.Classes.Ord Database.HamSql.Internal.Stmt.SqlStmtId instance GHC.Classes.Eq Database.HamSql.Internal.Stmt.SqlStmtId instance GHC.Show.Show Database.HamSql.Internal.Stmt.SqlStmtType instance GHC.Classes.Ord Database.HamSql.Internal.Stmt.SqlStmtType instance GHC.Classes.Eq Database.HamSql.Internal.Stmt.SqlStmtType instance GHC.Show.Show Database.HamSql.Internal.Stmt.SqlStmtId instance GHC.Classes.Eq Database.HamSql.Internal.Stmt.SqlStmt instance GHC.Classes.Ord Database.HamSql.Internal.Stmt.SqlStmt instance Database.YamSql.Internal.SqlId.ToSqlId Database.HamSql.Internal.Stmt.SqlStmt instance Database.PostgreSQL.Simple.FromField.FromField Database.YamSql.Internal.SqlId.SqlType instance Database.PostgreSQL.Simple.FromField.FromField Database.YamSql.Internal.SqlId.SqlName instance Database.YamSql.Internal.SqlId.ToSqlCode Database.HamSql.Internal.Stmt.SqlStmt module Database.HamSql.Setup data SetupContext SetupContext :: Setup -> SetupContext [setupContextSetup] :: SetupContext -> Setup data SetupElement [SetupElement] :: (ToSqlStmts a) => {setupElement :: a} -> SetupElement class (Typeable a) => ToSqlStmts a toSqlStmts :: ToSqlStmts a => SetupContext -> a -> [Maybe SqlStmt] -- | Setup data Setup Setup :: [SqlName] -> Maybe [FilePath] -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe [Schema] -> Setup [setupSchemas] :: Setup -> [SqlName] [setupSchemaDirs] :: Setup -> Maybe [FilePath] [setupRolePrefix] :: Setup -> Maybe Text [setupPreCode] :: Setup -> Maybe Text [setupPostCode] :: Setup -> Maybe Text [setupSchemaData] :: Setup -> Maybe [Schema] setupRolePrefix' :: Setup -> Text -- | Template handling and applyTemplate data WithSchema a WithSchema :: Schema -> a -> WithSchema a class WithName a name :: WithName a => a -> Text withoutSchema :: WithSchema a -> a selectTemplates :: (ToSqlCode a, WithName (WithSchema t)) => Maybe [a] -> [WithSchema t] -> [t] selectTemplate :: (ToSqlCode a1, WithName (WithSchema a)) => a1 -> [WithSchema a] -> a setupAllSchemas :: Setup -> [Schema] setupAllFunctionTemplates :: Setup -> [WithSchema FunctionTpl] setupAllTableTemplates :: Setup -> [WithSchema TableTpl] applyTpl :: Setup -> Setup instance GHC.Show.Show a => GHC.Show.Show (Database.HamSql.Setup.WithSchema a) instance Data.Data.Data Database.HamSql.Setup.Setup instance GHC.Show.Show Database.HamSql.Setup.Setup instance GHC.Generics.Generic Database.HamSql.Setup.Setup instance Database.HamSql.Setup.ToSqlStmts Database.HamSql.Setup.SetupElement instance Data.Aeson.Types.FromJSON.FromJSON Database.HamSql.Setup.Setup instance Data.Aeson.Types.ToJSON.ToJSON Database.HamSql.Setup.Setup instance Database.HamSql.Setup.WithName (Database.HamSql.Setup.WithSchema Database.YamSql.Internal.Obj.Table.TableTpl) instance Database.HamSql.Setup.WithName (Database.HamSql.Setup.WithSchema Database.YamSql.Internal.Obj.Function.FunctionTpl) module Database.HamSql.Internal.Load loadSetup :: OptCommon -> FilePath -> IO Setup loadSetupSchemas :: OptCommon -> FilePath -> Setup -> IO Setup loadSchemas :: OptCommon -> FilePath -> Setup -> [Schema] -> [SqlName] -> IO [Schema] findSchemaPath :: FilePath -> [FilePath] -> IO FilePath catchErrors :: (FromJSON a, ToJSON a) => FilePath -> a -> IO a isConfigDirFile :: FilePath -> Bool getFilesInDir :: FilePath -> IO [FilePath] selectFilesInDir :: (FilePath -> Bool) -> FilePath -> IO [FilePath] errorCheck :: Text -> Bool -> IO () readSchema :: OptCommon -> FilePath -> IO Schema readObjectFromFile :: (FromJSON a, ToJSON a) => OptCommon -> FilePath -> IO a readObject :: (FromJSON a, ToJSON a) => FilePath -> ByteString -> IO a readFunctionFromFile :: (FromJSON a, ToJSON a) => (a -> Text -> a) -> OptCommon -> FilePath -> IO a readYamSqlFile :: OptCommon -> FilePath -> IO ByteString module Database.HamSql.Internal.Documentation templateFromFile :: FilePath -> IO Template templateCompile :: Text -> Template docWrite :: OptDoc -> Setup -> IO () docWriteSchema :: OptDoc -> Template -> Schema -> IO () templateDefaultSchema :: Template module Database.HamSql.Internal.DbUtils sqlErrObjectInUse :: ByteString toQry :: Text -> Query logStmt :: OptCommonDb -> Text -> IO () getConUrl :: OptCommonDb -> URI pgsqlExecStmt :: Connection -> SqlStmt -> IO () pgsqlExecStmtHandled :: Connection -> SqlStmt -> IO () data PgSqlMode PgSqlWithoutTransaction :: PgSqlMode PgSqlWithTransaction :: PgSqlMode data Status Init :: Status Changed :: Status Unchanged :: Status pgsqlConnectUrl :: URI -> IO Connection pgsqlHandleErr :: SqlStmt -> Connection -> SqlError -> IO () instance GHC.Classes.Eq Database.HamSql.Internal.DbUtils.PgSqlMode module Database.HamSql.Internal.InquireDeployed sqlManageSchemaJoin :: Text -> Text deployedTableConstrIds :: Connection -> IO [SqlObj SQL_TABLE_CONSTRAINT (SqlName, SqlName, SqlName)] deployedDomainConstrIds :: Connection -> IO [SqlObj SQL_DOMAIN_CONSTRAINT (SqlName, SqlName)] -- | List SCHEMA deployedSchemaIds :: Connection -> IO [SqlObj SQL_SCHEMA SqlName] -- | List SEQUENCE deployedSequenceIds :: Connection -> IO [SqlObj SQL_SEQUENCE SqlName] -- | List TABLE deployedTableIds :: Connection -> IO [SqlObj SQL_TABLE SqlName] -- | List TABLE COLUMN deployedTableColumnIds :: Connection -> IO [SqlObj SQL_COLUMN (SqlName, SqlName)] -- | List TYPE deployedTypeIds :: Connection -> IO [SqlObj SQL_TYPE SqlName] -- | List ROLE deployedRoleIds :: Setup -> Connection -> IO [SqlObj SQL_ROLE SqlName] deployedRoleMemberIds :: Setup -> Connection -> IO [SqlObj SQL_ROLE_MEMBERSHIP (SqlName, SqlName)] -- | List DOMAIN deployedDomainIds :: Connection -> IO [SqlObj SQL_DOMAIN SqlName] deployedFunctionIds :: Connection -> IO [SqlObj SQL_FUNCTION (SqlName, [SqlType])] -- |