xpWrap )
-- Local imports.
-import Generics ( Generic(..), to_tuple )
+import Generics ( Generic(..), prepend, to_tuple )
import TSN.Codegen ( tsn_codegen_config )
import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate )
import TSN.Picklers ( xp_date, xp_time_stamp )
-- AutoRacingDriverListListing / AutoRacingDriverListListingXml
-- | Database representation of a \<Listing\> contained within a
--- \<message\>.
+-- \<message\>. The leading underscores prevent unused field
+-- warnings.
--
data AutoRacingDriverListListing =
AutoRacingDriverListListing {
- db_auto_racing_driver_lists_id :: DefaultKey AutoRacingDriverList,
- db_driver_id :: Int,
- db_driver :: String,
- db_height :: Maybe String,
- db_weight :: Int,
- db_date_of_birth :: UTCTime,
- db_hometown :: String,
- db_nationality :: Maybe String,
- db_car_number :: Int,
- db_car :: String }
+ _db_auto_racing_driver_lists_id :: DefaultKey AutoRacingDriverList,
+ _db_driver_id :: Int,
+ _db_driver :: String,
+ _db_height :: Maybe String,
+ _db_weight :: Int,
+ _db_date_of_birth :: UTCTime,
+ _db_hometown :: String,
+ _db_nationality :: Maybe String,
+ _db_car_number :: Int,
+ _db_car :: String }
+ deriving ( GHC.Generic )
+
+-- | For 'Generics.prepend'.
+--
+instance Generic AutoRacingDriverListListing
+
-- | XML representation of a \<Listing\> contained within a
--- \<message\>.
+-- \<message\>. The underscores prevent unused field warnings.
--
data AutoRacingDriverListListingXml =
AutoRacingDriverListListingXml {
- xml_driver_id :: Int,
- xml_driver :: String,
- xml_height :: Maybe String,
- xml_weight :: Int,
- xml_date_of_birth :: UTCTime,
- xml_hometown :: String,
- xml_nationality :: Maybe String,
- xml_car_number :: Int,
- xml_car :: String }
+ _xml_driver_id :: Int,
+ _xml_driver :: String,
+ _xml_height :: Maybe String,
+ _xml_weight :: Int,
+ _xml_date_of_birth :: UTCTime,
+ _xml_hometown :: String,
+ _xml_nationality :: Maybe String,
+ _xml_car_number :: Int,
+ _xml_car :: String }
deriving (Eq, GHC.Generic, Show)
-- | For 'Generics.to_tuple'.
-- 'AutoRacingDriverListListing', we add the foreign key and copy
-- everything else verbatim.
--
- from_xml_fk fk AutoRacingDriverListListingXml{..} =
- AutoRacingDriverListListing {
- db_auto_racing_driver_lists_id = fk,
- db_driver_id = xml_driver_id,
- db_driver = xml_driver,
- db_height = xml_height,
- db_weight = xml_weight,
- db_date_of_birth = xml_date_of_birth,
- db_hometown = xml_hometown,
- db_nationality = xml_nationality,
- db_car_number = xml_car_number,
- db_car = xml_car }
+ from_xml_fk = prepend
+
-- | This allows us to insert the XML representation
constructors:
- name: AutoRacingDriverListListing
fields:
- - name: db_auto_racing_driver_lists_id
+ - name: _db_auto_racing_driver_lists_id
reference:
onDelete: cascade