| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Database.GP.Entity
Synopsis
- class (Generic a, HasConstructor (Rep a), HasSelectors (Rep a)) => Entity a where
- columnNameFor :: forall a. Entity a => String -> String
- toString :: forall a. (Generic a, GShow' (Rep a)) => a -> String
- type EntityId = (String, SqlValue)
- gtoRow :: GToRow f => f a -> [SqlValue]
- class GToRow f
- class GFromRow f
- maybeFieldTypeFor :: forall a. Entity a => String -> Maybe TypeRep
- data Conn = forall conn.IConnection conn => Conn {
- db :: Database
- implicitCommit :: Bool
- connection :: conn
- data Database
Documentation
class (Generic a, HasConstructor (Rep a), HasSelectors (Rep a)) => Entity a where Source #
Minimal complete definition
Nothing
Methods
fromRow :: Conn -> [SqlValue] -> IO a Source #
Converts a database row to a value of type a.
toRow :: Conn -> a -> IO [SqlValue] Source #
Converts a value of type a to a database row.
Returns the name of the primary key field for a type a.
fieldsToColumns :: [(String, String)] Source #
Returns a list of tuples that map field names to column names for a type a.
default fieldsToColumns :: [(String, String)] Source #
Returns the name of the table for a type a.
columnNameFor :: forall a. Entity a => String -> String Source #
A convenience function: returns the name of the column for a field of a type a.
toString :: forall a. (Generic a, GShow' (Rep a)) => a -> String Source #
Returns a string representation of a value of type a.
type EntityId = (String, SqlValue) Source #
The EntityId is a tuple of the constructor name and the primary key value of an Entity.
Minimal complete definition
Instances
| GToRow (U1 :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
| (GToRow a, GToRow b) => GToRow (a :*: b :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
| Convertible a SqlValue => GToRow (K1 i a :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
| GToRow a => GToRow (M1 i c a :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
Minimal complete definition
gfromRow
Instances
| GFromRow (U1 :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
| (KnownNat (NumFields f), GFromRow f, GFromRow g) => GFromRow (f :*: g :: Type -> Type) Source # | This instance is the most interesting one. It splits the list of
|
Defined in Database.GP.Entity | |
| Convertible SqlValue a => GFromRow (K1 i a :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
| GFromRow a => GFromRow (M1 i c a :: k -> Type) Source # | |
Defined in Database.GP.Entity | |
A wrapper around an HDBC IConnection.
Constructors
| forall conn.IConnection conn => Conn | |
Fields
| |
Instances
| IConnection Conn Source # | manually implement the IConnection type class for the Conn type. |
Defined in Database.GP.Conn Methods disconnect :: Conn -> IO () runRaw :: Conn -> String -> IO () run :: Conn -> String -> [SqlValue] -> IO Integer prepare :: Conn -> String -> IO Statement hdbcDriverName :: Conn -> String hdbcClientVer :: Conn -> String proxiedClientName :: Conn -> String proxiedClientVer :: Conn -> String dbServerVer :: Conn -> String dbTransactionSupport :: Conn -> Bool getTables :: Conn -> IO [String] describeTable :: Conn -> String -> IO [(String, SqlColDesc)] | |
An enumeration of the supported database types.
Instances
| Enum Database Source # | |
| Show Database Source # | |
| Eq Database Source # | |