import TSN.Picklers ( xp_earnings, xp_datetime, xp_time_stamp )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
type Db AutoRacingResultsListingXml = AutoRacingResultsListing
-instance FromXmlFk AutoRacingResultsListingXml where
+instance Child AutoRacingResultsListingXml where
-- | Each 'AutoRacingResultsListingXml' is contained in (i.e. has a
-- foreign key to) a 'AutoRacingResults'.
--
type Parent AutoRacingResultsListingXml = AutoRacingResults
+
+instance FromXmlFk AutoRacingResultsListingXml where
-- | To convert an 'AutoRacingResultsListingXml' to an
-- 'AutoRacingResultsListing', we add the foreign key and copy
-- everything else verbatim.
type Db AutoRacingResultsRaceInformationXml =
AutoRacingResultsRaceInformation
-instance FromXmlFk AutoRacingResultsRaceInformationXml where
+
+instance Child AutoRacingResultsRaceInformationXml where
-- | Each 'AutoRacingResultsRaceInformationXml' is contained in
-- (i.e. has a foreign key to) a 'AutoRacingResults'.
--
type Parent AutoRacingResultsRaceInformationXml = AutoRacingResults
+
+instance FromXmlFk AutoRacingResultsRaceInformationXml where
-- | To convert an 'AutoRacingResultsRaceInformationXml' to an
-- 'AutoRacingResultsRaceInformartion', we add the foreign key and
-- copy everything else verbatim.
import TSN.Picklers ( xp_date_padded, xp_tba_time, xp_time_stamp )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
--
type Db AutoRacingScheduleListingXml = AutoRacingScheduleListing
-instance FromXmlFk AutoRacingScheduleListingXml where
+
+instance Child AutoRacingScheduleListingXml where
-- | Each 'AutoRacingScheduleListingXml' is contained in (i.e. has a
-- foreign key to) a 'AutoRacingSchedule'.
--
type Parent AutoRacingScheduleListingXml = AutoRacingSchedule
+
+instance FromXmlFk AutoRacingScheduleListingXml where
-- | To convert an 'AutoRacingScheduleListingXml' to an
-- 'AutoRacingScheduleListing', we add the foreign key and drop
-- the 'xml_race_results'. We also mash the date/time together
AutoRacingScheduleListingRaceResultRaceResultListing
-instance FromXmlFk AutoRacingScheduleListingRaceResultRaceResultListingXml where
+instance Child AutoRacingScheduleListingRaceResultRaceResultListingXml where
-- | Each 'AutoRacingScheduleListingRaceResultRaceResultListingXml'
-- is contained in (i.e. has a foreign key to) an
-- 'AutoRacingScheduleListing'. We skip the intermediate
type Parent AutoRacingScheduleListingRaceResultRaceResultListingXml =
AutoRacingScheduleListing
+
+instance FromXmlFk AutoRacingScheduleListingRaceResultRaceResultListingXml where
-- | To convert an
-- 'AutoRacingScheduleListingRaceResultRaceResultListingXml' to an
-- 'AutoRacingScheduleListingRaceResultRaceResultListing', we just
import TSN.Picklers ( xp_time_stamp )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
-- | The DB analogue of a 'InjuriesListingXml' is a 'InjuriesListing'
type Db InjuriesListingXml = InjuriesListing
-instance FromXmlFk InjuriesListingXml where
+instance Child InjuriesListingXml where
-- | Our foreign key points to an 'Injuries'.
type Parent InjuriesListingXml = Injuries
+instance FromXmlFk InjuriesListingXml where
-- | To convert between a 'InjuriesListingXml' and a
-- 'InjuriesListing', we simply append the foreign key.
from_xml_fk fk InjuriesListingXml{..} =
import TSN.Picklers( xp_date, xp_time_stamp )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
-- 'InjuriesDetailListing'.
type Db InjuriesDetailListingXml = InjuriesDetailListing
-instance FromXmlFk InjuriesDetailListingXml where
+
+instance Child InjuriesDetailListingXml where
-- | Each 'InjuriesDetailListingXml' is contained in an
-- 'InjuriesDetail'.
type Parent InjuriesDetailListingXml = InjuriesDetail
+
+instance FromXmlFk InjuriesDetailListingXml where
-- | Construct a 'InjuriesDetailListing' from a
-- 'InjuriesDetailListingXml' and a foreign key to a
-- 'InjuriesDetail'.
type Db InjuriesDetailListingPlayerListingXml =
InjuriesDetailListingPlayerListing
-instance FromXmlFk InjuriesDetailListingPlayerListingXml where
+
+instance Child InjuriesDetailListingPlayerListingXml where
-- | Each 'InjuriesDetailListingPlayerListingXml' is contained in an
-- 'InjuriesDetailListing'.
--
type Parent InjuriesDetailListingPlayerListingXml = InjuriesDetailListing
+
+instance FromXmlFk InjuriesDetailListingPlayerListingXml where
-- | To construct a 'InjuriesDetailListingPlayerListing' from a
-- 'InjuriesDetailListingPlayerListingXml' we need to supply a
-- foreign key to an 'InjuriesDetailListing'.
import TSN.Team ( Team(..) )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
--
type Db OddsGameXml = OddsGame
-instance FromXmlFk OddsGameXml where
+
+instance Child OddsGameXml where
-- | Each 'OddsGameXml' is contained in an 'Odds'. In other words
-- the foreign key for 'OddsGame' points to an 'Odds'.
--
type Parent OddsGameXml = Odds
+
+instance FromXmlFk OddsGameXml where
-- | To convert from the XML representation to the database one, we
-- drop the home/away teams and the casino lines, but retain the
-- home/away rotation numbers and the starters.
import TSN.Picklers ( xp_time_stamp )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
--
type Db ScoreGameXml = ScoreGame
-instance FromXmlFk ScoreGameXml where
+
+instance Child ScoreGameXml where
-- | Each 'ScoreGameXml' is contained in (i.e. has a foreign key to)
-- a 'Score'.
--
type Parent ScoreGameXml = Score
+
+instance FromXmlFk ScoreGameXml where
from_xml_fk fk ScoreGameXml{..} =
ScoreGame {
db_scores_id = fk,
import TSN.Picklers ( xp_gamedate, xp_time_stamp )
import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) )
import Xml (
+ Child(..),
FromXml(..),
FromXmlFk(..),
ToDb(..),
instance ToDb WeatherForecastListingXml where
type Db WeatherForecastListingXml = WeatherForecastListing
--- | This is needed to define the 'XmlImportFk' instance for
--- 'WeatherForecastListing'.
---
-instance FromXmlFk WeatherForecastListingXml where
+
+instance Child WeatherForecastListingXml where
-- | Each 'WeatherForecastListingXml' is contained in a
-- 'WeatherForecast'.
--
type Parent WeatherForecastListingXml = WeatherForecast
+
+-- | This is needed to define the 'XmlImportFk' instance for
+-- 'WeatherForecastListing'.
+--
+instance FromXmlFk WeatherForecastListingXml where
from_xml_fk fk WeatherForecastListingXml{..} =
WeatherForecastListing {
db_weather_forecasts_id = fk,
--
type Db WeatherForecastXml = WeatherForecast
-instance FromXmlFk WeatherForecastXml where
+
+instance Child WeatherForecastXml where
+ -- | The database type containing a 'WeatherForecastXml' is
+ -- 'Weather'.
type Parent WeatherForecastXml = Weather
+
+instance FromXmlFk WeatherForecastXml where
+
-- | To convert a 'WeatherForecastXml' into a 'WeatherForecast', we
-- replace the 'WeatherLeague' with its name.
--