-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A type-safe SQL mapper for Haskell that doesn't use Template Haskell -- -- See the documentation on my blog and on GitHub. @package beam @version 0.3.0.0 module Database.Beam.Internal data DBSchemaComparison Migration :: [MigrationAction] -> DBSchemaComparison Unknown :: DBSchemaComparison data MigrationAction MACreateTable :: Text -> Proxy table -> MigrationAction class BeamBackend backendSettings openBeam :: (BeamBackend backendSettings, MonadIO m, Database d) => DatabaseSettings d -> backendSettings -> m (Beam d m) data Beam d m Beam :: DatabaseSettings d -> Bool -> m () -> (ReifiedDatabaseSchema -> DatabaseSettings d -> DBSchemaComparison) -> (SQLColumnSchema -> SQLColumnSchema) -> (Text -> m [SqlValue]) -> (forall a. (forall conn. IConnection conn => conn -> m a) -> m a) -> Beam d m [beamDbSettings] :: Beam d m -> DatabaseSettings d [beamDebug] :: Beam d m -> Bool [closeBeam] :: Beam d m -> m () [compareSchemas] :: Beam d m -> ReifiedDatabaseSchema -> DatabaseSettings d -> DBSchemaComparison [adjustColDescForBackend] :: Beam d m -> SQLColumnSchema -> SQLColumnSchema [getLastInsertedRow] :: Beam d m -> Text -> m [SqlValue] [withHDBCConnection] :: Beam d m -> forall a. (forall conn. IConnection conn => conn -> m a) -> m a newtype BeamT e d m a BeamT :: (Beam d m -> m (BeamResult e a)) -> BeamT e d m a [runBeamT] :: BeamT e d m a -> Beam d m -> m (BeamResult e a) data BeamResult e a Success :: a -> BeamResult e a Rollback :: (BeamRollbackReason e) -> BeamResult e a data BeamRollbackReason e InternalError :: String -> BeamRollbackReason e UserError :: e -> BeamRollbackReason e transBeam :: Functor m => (forall a. (s -> m (a, Maybe b)) -> n a) -> (forall a. n a -> s -> m (a, b)) -> Beam d m -> Beam d n instance (GHC.Show.Show e, GHC.Show.Show a) => GHC.Show.Show (Database.Beam.Internal.BeamResult e a) instance GHC.Show.Show e => GHC.Show.Show (Database.Beam.Internal.BeamRollbackReason e) instance GHC.Show.Show Database.Beam.Internal.DBSchemaComparison instance GHC.Show.Show Database.Beam.Internal.MigrationAction instance Control.Monad.Trans.Error.Error (Database.Beam.Internal.BeamRollbackReason e) instance GHC.Base.Monad m => GHC.Base.Monad (Database.Beam.Internal.BeamT e d m) instance GHC.Base.Monad m => GHC.Base.Functor (Database.Beam.Internal.BeamT e d m) instance GHC.Base.Monad m => GHC.Base.Applicative (Database.Beam.Internal.BeamT e d m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Database.Beam.Internal.BeamT e d m) instance Control.Monad.Trans.Class.MonadTrans (Database.Beam.Internal.BeamT e d) -- | Defines type classes for Tables and Databases. -- -- All important class methods of these classes can be derived -- automatically using Generics and GHC's DefaultSignatures -- extension, but you can override any method if necessary. -- -- To get started, see Table, Columnar, and -- Nullable. module Database.Beam.Schema class Database db where allTables f db = allTables' f (from' db) allTables :: Database db => (forall tbl. Table tbl => f tbl -> b) -> db f -> [b] data GenDatabaseTable db GenDatabaseTable :: DatabaseTable db table -> GenDatabaseTable db data DatabaseTable (db :: (((* -> *) -> *) -> *) -> *) table DatabaseTable :: Proxy table -> Text -> DatabaseTable db table type DatabaseSettings db = db (DatabaseTable db) type ReifiedDatabaseSchema = [(Text, ReifiedTableSchema)] type ReifiedTableSchema = [(Text, SQLColumnSchema)] autoDbSettings :: (Generic (DatabaseSettings db), GAutoDbSettings (Rep (DatabaseSettings db) ())) => DatabaseSettings db allTableSettings :: Database db => DatabaseSettings db -> [GenDatabaseTable db] newtype BeamEnum a BeamEnum :: a -> BeamEnum a [unBeamEnum] :: BeamEnum a -> a newtype SqlValue' x SqlValue' :: SqlValue -> SqlValue' x data Lenses (t :: (* -> *) -> *) (f :: * -> *) x data LensFor t x LensFor :: Lens' t x -> LensFor t x -- | A type family that we use to "tag" columns in our table datatypes. -- -- This is what allows us to use the same table type to hold table data, -- describe table settings, derive lenses, and provide expressions. -- -- The basic rules are -- --
-- Columnar Identity x = x -- Columnar Identity (BeamEnum x) = x ---- -- Thus, any Beam table applied to Identity will yield a -- simplified version of the data type, that contains just what you'd -- expect. Enum types tagged with BeamEnum, are automatically -- unwrapped in the simplified data structure. -- --
-- Columnar (Nullable c) x = Columnar c (Maybe x) ---- -- The Nullable type is used when referencing PrimaryKeys -- that we want to include optionally. For example, if we have a table -- with a PrimaryKey, like the following -- --
-- data BeamTableT f = BeamTableT
-- { _refToAnotherTable :: PrimaryKey AnotherTableT f
-- , ... }
--
--
-- we would typically be required to provide values for the
-- PrimaryKey embedded into BeamTableT. We can use
-- Nullable to lift this constraint.
--
--
-- data BeamTableT f = BeamTableT
-- { _refToAnotherTable :: PrimaryKey AnotherTableT (Nullable f)
-- , ... }
--
--
-- Now we can use justRef and nothingRef to refer to
-- this table optionally. The embedded PrimaryKey in
-- _refToAnotherTable automatically has its fields converted
-- into Maybe using Nullable.
--
-- The last Columnar rule is
--
-- -- Columnar f x = f x ---- -- Use this rule if you'd like to parameterize your table type over any -- other functor. For example, this is used in the query modules to write -- expressions such as 'TableT QExpr', which returns a table whose fields -- have been turned into query expressions. -- -- The other rules are used within Beam to provide lenses and to expose -- the inner structure of the data type. newtype Columnar' f a Columnar' :: (Columnar f a) -> Columnar' f a -- | Support for NULLable Foreign Key references. -- --
-- data MyTable f = MyTable
-- { nullableRef :: PrimaryKey AnotherTable (Nullable f)
-- , ... }
-- deriving (Generic, Typeable)
--
--
-- See Columnar for more information.
data Nullable (c :: * -> *) x
-- | Metadata for a field of type ty in table.
--
-- -- Columnar (TableField table) ty = TableField table ty ---- -- This is used to declare tblFieldSettings in the Table -- class. -- -- It is easiest to access these fields through the lenses -- fieldName, fieldConstraints, and fieldSettings. -- --
-- data EmployeeT f = Employee
-- { _employeeId :: Columnar f AutoId
-- , _employeeDepartment :: Columnar f Text
-- , _employeeFirstName :: Columnar f Text
-- , _employeeLastName :: Columnar f Text }
-- deriving Generic
--
--
-- Now we can use tableConfigLenses and the TableField
-- lenses to modify the default table configuration
--
-- -- Employee (LensFor employeeIdC) (LensFor employeeDepartmentC) (LensFor employeeFirstNameC) (LensFor employeeLastNameC) = tableConfigLenses -- -- instance Table EmployeeT where -- type PrimaryKey EmployeeT f = PK f AutoId -- primaryKey = PK . _beamEmployeeId -- -- tblFieldSettings = defTblFieldSettings -- & employeeFirstNameC . fieldName .~ "fname" -- & employeeLastNameC . fieldName .~ "lname" -- & employeeLastNameC . fieldSettings .~ Varchar (Just 128) -- Give it a 128 character limit --data TableField (table :: (* -> *) -> *) ty TableField :: Text -> [SQLConstraint] -> FieldSettings ty -> TableField ty -- | The field name [_fieldName] :: TableField ty -> Text -- | Constraints for the field (such as AutoIncrement, PrimaryKey, etc) [_fieldConstraints] :: TableField ty -> [SQLConstraint] -- | Settings for the field [_fieldSettings] :: TableField ty -> FieldSettings ty fieldName :: Lens' (TableField table ty) Text fieldConstraints :: Lens' (TableField table ty) [SQLConstraint] fieldSettings :: Lens (TableField table a) (TableField table b) (FieldSettings a) (FieldSettings b) type TableSettings table = table (TableField table) -- | The big Kahuna! All beam tables implement this class. -- -- The kind of all table types is `(* -> *) -> *`. This is because -- all table types are actually table type constructors. Every -- table type takes in another type constructor, called the column -- tag, and uses that constructor to instantiate the column types. -- See the documentation for Columnar. In order for the default -- deriving to work, every type passed into Columnar must be an -- instance of FieldSchema. -- -- This class is mostly Generic-derivable. You need only specify a type -- for the table's primary key and a method to extract the primary key -- given the table. -- -- Even though all methods are derivable, you are free to override them. -- Typically, you may want to override tblFieldSettings if you -- want to specify options for column storage or to rename columns. See -- TableField for more information. You may want to use -- tableConfigLenses to simplify accessing -- tblFieldSettings. -- -- An example table: -- --
-- data BlogPostT f = BlogPost
-- { _blogPostSlug :: Columnar f Text
-- , _blogPostBody :: Columnar f Text
-- , _blogPostDate :: Columnar f UTCTime
-- , _blogPostAuthor :: PrimaryKey AuthorT f
-- , _blogPostTagline :: Columnar f (Maybe Text)
-- , _blogPostImageGallery :: PrimaryKey ImageGalleryT (Nullable f) }
-- deriving Generic
-- instance Table BlogPostT where
-- type PrimaryKey BlogPostT f = PK f Text
-- primaryKey = PK . _blogPostSlug
--
--
-- We can interpret this as follows:
--
--
-- data AuthorT f = AuthorT
-- { _authorEmail :: Columnar f Text
-- , _authorFirstName :: Columnar f Text
-- , _authorLastName :: Columnar f Text }
-- deriving Generic
--
-- data BlogPostT f = BlogPost
-- { _blogPostSlug :: Columnar f Text
-- , _blogPostBody :: Columnar f Text
-- , _blogPostDate :: Columnar f UTCTime
-- , _blogPostAuthor :: ForeignKey AuthorT f
-- , _blogPostTagline :: Columnar f (Maybe Text) }
-- deriving Generic
-- instance Table BlogPostT where
-- type PrimaryKey BlogPostT f = PK f Text
-- primaryKey = PK . _blogPostSlug
-- instance Table AuthorT where
-- type PrimaryKey AuthorT f = PK f Text
-- primaryKey = PK . _authorEmail
--
--
-- -- BlogPost (LensFor blogPostSlug -- (LensFor blogPostBody) -- (LensFor blogPostDate) -- (ForeignKey (PK (LensFor blogPostAuthorEmail))) -- (LensFor blogPostTagLine) = tableConfigLenses --tableConfigLenses :: (lensType ~ Lenses t (TableField t), Generic (t lensType), Generic (t (TableField t)), GTableLenses t (TableField t) (Rep (t (TableField t))) (Rep (t lensType))) => t (Lenses t (TableField t)) module Database.Beam.Query.Internal class IsQuery q toQ :: IsQuery q => q db s a -> Q db s a newtype Q (db :: (((* -> *) -> *) -> *) -> *) s a Q :: State QueryBuilder a -> Q s a [runQ] :: Q s a -> State QueryBuilder a -- | Wrapper for Qs that have been modified in such a way that they -- can no longer be joined against without the use of subquery. -- TopLevelQ is also an instance of IsQuery, and so can be -- passed directly to query or queryList newtype TopLevelQ db s a TopLevelQ :: (Q db s a) -> TopLevelQ db s a data QueryBuilder QueryBuilder :: Int -> Maybe SQLFrom -> QExpr Bool -> Maybe Integer -> Maybe Integer -> [SQLOrdering] -> Maybe SQLGrouping -> QueryBuilder [qbNextTblRef] :: QueryBuilder -> Int [qbFrom] :: QueryBuilder -> Maybe SQLFrom [qbWhere] :: QueryBuilder -> QExpr Bool [qbLimit] :: QueryBuilder -> Maybe Integer [qbOffset] :: QueryBuilder -> Maybe Integer [qbOrdering] :: QueryBuilder -> [SQLOrdering] [qbGrouping] :: QueryBuilder -> Maybe SQLGrouping data QField QField :: Text -> Maybe Int -> Text -> QField [qFieldTblName] :: QField -> Text [qFieldTblOrd] :: QField -> Maybe Int [qFieldName] :: QField -> Text newtype QExpr t QExpr :: (SQLExpr' QField) -> QExpr t class Projectible a project :: Projectible a => a -> [SQLExpr' QField] tableVal :: Table tbl => tbl Identity -> tbl QExpr instance Control.Monad.State.Class.MonadState Database.Beam.Query.Internal.QueryBuilder (Database.Beam.Query.Internal.Q db s) instance Control.Monad.Fix.MonadFix (Database.Beam.Query.Internal.Q db s) instance GHC.Base.Functor (Database.Beam.Query.Internal.Q db s) instance GHC.Base.Applicative (Database.Beam.Query.Internal.Q db s) instance GHC.Base.Monad (Database.Beam.Query.Internal.Q db s) instance GHC.Classes.Eq (Database.Beam.Query.Internal.QExpr t) instance GHC.Show.Show (Database.Beam.Query.Internal.QExpr t) instance GHC.Classes.Ord Database.Beam.Query.Internal.QField instance GHC.Classes.Eq Database.Beam.Query.Internal.QField instance GHC.Show.Show Database.Beam.Query.Internal.QField instance Data.Typeable.Internal.Typeable a => Database.Beam.Query.Internal.Projectible (Database.Beam.Query.Internal.QExpr a) instance (Database.Beam.Query.Internal.Projectible a, Database.Beam.Query.Internal.Projectible b) => Database.Beam.Query.Internal.Projectible (a, b) instance (Database.Beam.Query.Internal.Projectible a, Database.Beam.Query.Internal.Projectible b, Database.Beam.Query.Internal.Projectible c) => Database.Beam.Query.Internal.Projectible (a, b, c) instance (Database.Beam.Query.Internal.Projectible a, Database.Beam.Query.Internal.Projectible b, Database.Beam.Query.Internal.Projectible c, Database.Beam.Query.Internal.Projectible d) => Database.Beam.Query.Internal.Projectible (a, b, c, d) instance (Database.Beam.Query.Internal.Projectible a, Database.Beam.Query.Internal.Projectible b, Database.Beam.Query.Internal.Projectible c, Database.Beam.Query.Internal.Projectible d, Database.Beam.Query.Internal.Projectible e) => Database.Beam.Query.Internal.Projectible (a, b, c, d, e) instance Database.Beam.Schema.Tables.Table t => Database.Beam.Query.Internal.Projectible (t Database.Beam.Query.Internal.QExpr) module Database.Beam.SQL -- | Convert a SQLCommand into a SQL expression (with placeholders) -- and literal values to be submitted to the SQL server. Splitting into a -- SQL expression and literals prevents SQL injection attacks. ppSQL :: SQLCommand -> (String, [SqlValue]) noConstraints :: SqlColDesc -> SQLColumnSchema notNull :: SqlColDesc -> SQLColumnSchema data SQLCommand Select :: SQLSelect -> SQLCommand Insert :: SQLInsert -> SQLCommand Update :: SQLUpdate -> SQLCommand Delete :: SQLDelete -> SQLCommand CreateTable :: SQLCreateTable -> SQLCommand data SQLCreateTable SQLCreateTable :: Text -> [(Text, SQLColumnSchema)] -> SQLCreateTable [ctTableName] :: SQLCreateTable -> Text [ctFields] :: SQLCreateTable -> [(Text, SQLColumnSchema)] data SQLColumnSchema SQLColumnSchema :: SqlColDesc -> [SQLConstraint] -> SQLColumnSchema [csType] :: SQLColumnSchema -> SqlColDesc [csConstraints] :: SQLColumnSchema -> [SQLConstraint] data SQLConstraint SQLPrimaryKey :: SQLConstraint SQLAutoIncrement :: SQLConstraint SQLNotNull :: SQLConstraint data SQLInsert SQLInsert :: Text -> [SqlValue] -> SQLInsert [iTableName] :: SQLInsert -> Text [iValues] :: SQLInsert -> [SqlValue] data SQLUpdate SQLUpdate :: [Text] -> [(SQLFieldName, SQLExpr)] -> Maybe SQLExpr -> SQLUpdate [uTableNames] :: SQLUpdate -> [Text] [uAssignments] :: SQLUpdate -> [(SQLFieldName, SQLExpr)] [uWhere] :: SQLUpdate -> Maybe SQLExpr data SQLDelete SQLDelete :: Text -> Maybe SQLExpr -> SQLDelete [dTableName] :: SQLDelete -> Text [dWhere] :: SQLDelete -> Maybe SQLExpr data SQLSelect SQLSelect :: SQLProjection -> Maybe SQLFrom -> SQLExpr -> Maybe SQLGrouping -> [SQLOrdering] -> Maybe Integer -> Maybe Integer -> SQLSelect [selProjection] :: SQLSelect -> SQLProjection [selFrom] :: SQLSelect -> Maybe SQLFrom [selWhere] :: SQLSelect -> SQLExpr [selGrouping] :: SQLSelect -> Maybe SQLGrouping [selOrderBy] :: SQLSelect -> [SQLOrdering] [selLimit] :: SQLSelect -> Maybe Integer [selOffset] :: SQLSelect -> Maybe Integer data SQLFieldName SQLFieldName :: Text -> SQLFieldName SQLQualifiedFieldName :: Text -> Text -> SQLFieldName data SQLAliased a SQLAliased :: a -> (Maybe Text) -> SQLAliased a data SQLProjection -- | The * from SELECT * SQLProjStar :: SQLProjection SQLProj :: [SQLAliased SQLExpr] -> SQLProjection data SQLSource SQLSourceTable :: Text -> SQLSource SQLSourceSelect :: SQLSelect -> SQLSource data SQLJoinType SQLInnerJoin :: SQLJoinType SQLLeftJoin :: SQLJoinType SQLRightJoin :: SQLJoinType SQLOuterJoin :: SQLJoinType data SQLFrom SQLFromSource :: (SQLAliased SQLSource) -> SQLFrom SQLJoin :: SQLJoinType -> SQLFrom -> SQLFrom -> SQLExpr -> SQLFrom data SQLGrouping SQLGrouping :: [SQLExpr] -> SQLExpr -> SQLGrouping [sqlGroupBy] :: SQLGrouping -> [SQLExpr] [sqlHaving] :: SQLGrouping -> SQLExpr data SQLOrdering Asc :: SQLExpr -> SQLOrdering Desc :: SQLExpr -> SQLOrdering data SQLExpr' f SQLValE :: SqlValue -> SQLExpr' f SQLFieldE :: f -> SQLExpr' f SQLBinOpE :: Text -> (SQLExpr' f) -> (SQLExpr' f) -> SQLExpr' f SQLUnOpE :: Text -> (SQLExpr' f) -> SQLExpr' f SQLIsNothingE :: (SQLExpr' f) -> SQLExpr' f SQLIsJustE :: (SQLExpr' f) -> SQLExpr' f SQLListE :: [SQLExpr' f] -> SQLExpr' f SQLFuncE :: Text -> [SQLExpr' f] -> SQLExpr' f type SQLExpr = SQLExpr' SQLFieldName module Database.Beam.Backend reifyDBSchema :: Database db => DatabaseSettings db -> ReifiedDatabaseSchema defaultBeamCompareSchemas :: Database db => ReifiedDatabaseSchema -> DatabaseSettings db -> DBSchemaComparison hdbcSchema :: (IConnection conn, MonadIO m) => conn -> m ReifiedDatabaseSchema createStmtFor :: Table t => Beam db m -> Text -> Proxy t -> SQLCreateTable migrateDB :: MonadIO m => DatabaseSettings db -> Beam db m -> [MigrationAction] -> m () autoMigrateDB :: MonadIO m => DatabaseSettings d -> Beam d m -> m () openDatabaseDebug :: (BeamBackend dbSettings, MonadIO m, Database db) => DatabaseSettings db -> dbSettings -> m (Beam db m) openDatabase :: (BeamBackend dbSettings, MonadIO m, Database db) => DatabaseSettings db -> dbSettings -> m (Beam db m) openDatabase' :: (BeamBackend dbSettings, MonadIO m, Database db) => Bool -> DatabaseSettings db -> dbSettings -> m (Beam db m) dumpSchema :: Database db => DatabaseSettings db -> IO () instance GHC.Base.Monoid Database.Beam.Internal.DBSchemaComparison module Database.Beam.Backend.Sqlite3 data Sqlite3Settings Sqlite3Settings :: FilePath -> Sqlite3Settings getLastInsertedRow' :: MonadIO m => Connection -> Text -> m [SqlValue] (++.) :: QExpr Text -> QExpr Text -> QExpr Text instance GHC.Show.Show Database.Beam.Backend.Sqlite3.Sqlite3Settings instance Database.Beam.Internal.BeamBackend Database.Beam.Backend.Sqlite3.Sqlite3Settings module Database.Beam.Query data Q (db :: (((* -> *) -> *) -> *) -> *) s a data QExpr t -- | Wrapper for Qs that have been modified in such a way that they -- can no longer be joined against without the use of subquery. -- TopLevelQ is also an instance of IsQuery, and so can be -- passed directly to query or queryList data TopLevelQ db s a class IsQuery q class Projectible a project :: Projectible a => a -> [SQLExpr' QField] data Aggregation a GroupAgg :: (SQLExpr' QField) -> Aggregation a GenericAgg :: Text -> [SQLExpr' QField] -> Aggregation a queryToSQL' :: Projectible a => Q db s a -> (a, SQLSelect) allExprOpts :: Applicative f => SQLExpr -> f (Maybe SQLExpr) mkSqlField :: QField -> SQLFieldName optimizeExpr :: QExpr a -> SQLExpr optimizeExpr' :: SQLExpr' QField -> SQLExpr -- | Introduce all entries of a table into the Q monad all_ :: Database db => DatabaseTable db table -> Q db s (table QExpr) -- | Introduce all entries of a table into the Q monad based on the -- given SQLExpr join_ :: Database db => DatabaseTable db table -> QExpr Bool -> Q db s (table QExpr) -- | Only allow results for which the QExpr yields True guard_ :: QExpr Bool -> Q db s () -- | Introduce all entries of the given table which are referenced by the -- given ForeignKey related_ :: (Database db, Table rel) => DatabaseTable db rel -> PrimaryKey rel QExpr -> Q db s (rel QExpr) lookup_ :: (Database db, Table rel) => DatabaseTable db rel -> PrimaryKey rel QExpr -> Q db s (rel QExpr) references_ :: Table tbl => PrimaryKey tbl QExpr -> tbl QExpr -> QExpr Bool -- | Limit the number of results returned by a query. -- -- The resulting query is a top-level one that must be passed to -- query, queryList, or subquery_. See -- TopLevelQ for details. limit_ :: IsQuery q => Integer -> q db s a -> TopLevelQ db s a -- | Drop the first offset' results. -- -- The resulting query is a top-level one that must be passed to -- query, queryList, or subquery_. See -- TopLevelQ for details. offset_ :: IsQuery q => Integer -> q db s a -> TopLevelQ db s a (<.) :: QExpr a -> QExpr a -> QExpr Bool (>.) :: QExpr a -> QExpr a -> QExpr Bool (<=.) :: QExpr a -> QExpr a -> QExpr Bool (>=.) :: QExpr a -> QExpr a -> QExpr Bool (==.) :: SqlOrd a => a -> a -> QExpr Bool (/=.) :: SqlOrd a => a -> a -> QExpr Bool (&&.) :: QExpr Bool -> QExpr Bool -> QExpr Bool (||.) :: QExpr Bool -> QExpr Bool -> QExpr Bool not_ :: QExpr Bool -> QExpr Bool div_ :: Integral a => QExpr a -> QExpr a -> QExpr a mod_ :: Integral a => QExpr a -> QExpr a -> QExpr a class SqlValable a val_ :: SqlValable a => HaskellLiteralForQExpr a -> a enum_ :: Show a => a -> QExpr (BeamEnum a) aggregate :: (Projectible a, Aggregating agg) => (a -> agg) -> (forall s. Q db s a) -> Q db s (LiftAggregationsToQExpr agg) group_ :: QExpr a -> Aggregation a sum_ :: Num a => QExpr a -> Aggregation a count_ :: QExpr a -> Aggregation Int orderBy :: (SqlOrderable ordering, IsQuery q) => (a -> ordering) -> q db s a -> TopLevelQ db s a asc_ :: QExpr a -> SQLOrdering desc_ :: QExpr a -> SQLOrdering subquery_ :: (IsQuery q, Projectible a, Subqueryable a) => (forall s. q db s a) -> Q db s a beamTxn :: MonadIO m => Beam db m -> (DatabaseSettings db -> BeamT e db m a) -> m (BeamResult e a) insertInto :: (MonadIO m, Functor m, Table table, FromSqlValues (table Identity)) => DatabaseTable db table -> table Identity -> BeamT e db m (table Identity) query :: (IsQuery q, MonadIO m, Functor m, FromSqlValues (QExprToIdentity a), Projectible a) => (forall s. q db s a) -> BeamT e db m (Source (BeamT e db m) (QExprToIdentity a)) queryList :: (IsQuery q, MonadIO m, Functor m, FromSqlValues (QExprToIdentity a), Projectible a) => (forall s. q db s a) -> BeamT e db m [QExprToIdentity a] getOne :: (IsQuery q, MonadIO m, Functor m, FromSqlValues (QExprToIdentity a), Projectible a) => (forall s. q db s a) -> BeamT e db m (Maybe (QExprToIdentity a)) updateWhere :: (MonadIO m, Table tbl) => DatabaseTable db tbl -> (tbl QExpr -> tbl QExpr) -> (tbl QExpr -> QExpr Bool) -> BeamT e db m () saveTo :: (MonadIO m, Table tbl) => DatabaseTable db tbl -> tbl Identity -> BeamT e db m () deleteWhere :: (MonadIO m, Table tbl) => DatabaseTable db tbl -> (tbl QExpr -> QExpr Bool) -> BeamT e db m () deleteFrom :: (MonadIO m, Table tbl) => DatabaseTable db tbl -> PrimaryKey tbl Identity -> BeamT e db m () -- | Top-level Beam module. This module re-exports all the symbols -- necessary for most common user operations. -- -- The most interesting modules are Schema and Query. -- -- SQL contains an internal representation of SQL that can be -- easily converted to textual SQL. Backend offers functions to -- run Beam queries and data manipulation commands within specific SQL -- backends. -- -- For a series of tutorials, see my series of blog posts at -- -- module Database.Beam -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable (a :: k) -- | Representable types of kind *. This class is derivable in GHC with the -- DeriveGeneric flag on. class Generic a -- | Identity functor and monad. (a non-strict monad) data Identity a :: * -> * -- | Lift a computation from the IO monad. liftIO :: MonadIO m => forall a. IO a -> m a data Beam d m class BeamBackend backendSettings data BeamT e d m a data BeamResult e a Success :: a -> BeamResult e a Rollback :: (BeamRollbackReason e) -> BeamResult e a data BeamRollbackReason e InternalError :: String -> BeamRollbackReason e UserError :: e -> BeamRollbackReason e