Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Butler.Database
Contents
Description
This module contains logic around sqlite-easy
Synopsis
- data Database
- withDatabase :: StorageAddress -> DatabaseMigration -> (Database -> ProcessIO a) -> ProcessIO a
- data DatabaseMigration = DatabaseMigration {
- migrations :: [MigrationName]
- migrateUp :: MigrationName -> Database -> ProcessIO ()
- migrateDown :: MigrationName -> Database -> ProcessIO ()
- dbSimpleCreate :: Text -> Text -> DatabaseMigration
- dbExecute :: MonadUnliftIO m => Database -> Query -> [NamedParam] -> m ()
- dbQuery :: (MonadUnliftIO m, FromRow r) => Database -> Query -> [NamedParam] -> m [r]
- data NamedParam where
- (:=) :: forall v. ToField v => Text -> v -> NamedParam
- newtype Only a = Only {
- fromOnly :: a
Documentation
withDatabase :: StorageAddress -> DatabaseMigration -> (Database -> ProcessIO a) -> ProcessIO a #
data DatabaseMigration #
Constructors
DatabaseMigration | |
Fields
|
dbSimpleCreate :: Text -> Text -> DatabaseMigration #
dbExecute :: MonadUnliftIO m => Database -> Query -> [NamedParam] -> m () #
dbQuery :: (MonadUnliftIO m, FromRow r) => Database -> Query -> [NamedParam] -> m [r] #
re-export
data NamedParam where #
Constructors
(:=) :: forall v. ToField v => Text -> v -> NamedParam infixr 3 |
Instances
Show NamedParam | |
Defined in Database.SQLite.Simple Methods showsPrec :: Int -> NamedParam -> ShowS # show :: NamedParam -> String # showList :: [NamedParam] -> ShowS # |
The 1-tuple type or single-value "collection".
This type is structurally equivalent to the
Identity
type, but its intent is more
about serving as the anonymous 1-tuple type missing from Haskell for attaching
typeclass instances.
Parameter usage example:
encodeSomething (Only
(42::Int))
Result usage example:
xs <- decodeSomething
forM_ xs $ \(Only
id) -> {- ... -}
Instances
Functor Only | |
Data a => Data (Only a) | |
Defined in Data.Tuple.Only Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Only a -> c (Only a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Only a) # toConstr :: Only a -> Constr # dataTypeOf :: Only a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Only a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Only a)) # gmapT :: (forall b. Data b => b -> b) -> Only a -> Only a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Only a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Only a -> r # gmapQ :: (forall d. Data d => d -> u) -> Only a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Only a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Only a -> m (Only a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Only a -> m (Only a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Only a -> m (Only a) # | |
Generic (Only a) | |
Read a => Read (Only a) | |
Show a => Show (Only a) | |
NFData a => NFData (Only a) | |
Defined in Data.Tuple.Only | |
Eq a => Eq (Only a) | |
Ord a => Ord (Only a) | |
FromField a => FromRow (Only a) | |
Defined in Database.SQLite.Simple.FromRow | |
ToField a => ToRow (Only a) | |
Defined in Database.SQLite.Simple.ToRow | |
type Rep (Only a) | |
Defined in Data.Tuple.Only |