import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate )
import TSN.Picklers ( xp_date, xp_time )
import TSN.XmlImport ( XmlImport(..) )
-import Xml ( FromXml(..), pickle_unpickle, unpickleable )
+import Xml ( FromXml(..), ToDb(..), pickle_unpickle, unpickleable )
deriving (Eq, Show)
-instance FromXml OddsGameCasinoXml where
+instance ToDb OddsGameCasinoXml where
-- | The database representation of an 'OddsGameCasinoXml' is an
-- 'OddsCasino'.
--
type Db OddsGameCasinoXml = OddsCasino
+instance FromXml OddsGameCasinoXml where
-- | We convert from XML to the database by dropping the line field.
from_xml OddsGameCasinoXml{..} =
OddsCasino {
xml_home_casinos :: [OddsGameCasinoXml] }
deriving (Eq, Show)
-instance FromXml OddsGameHomeTeamXml where
+instance ToDb OddsGameHomeTeamXml where
-- | The database representation of an 'OddsGameHomeTeamXml' is an
-- 'OddsGameTeam'.
--
type Db OddsGameHomeTeamXml = OddsGameTeam
+instance FromXml OddsGameHomeTeamXml where
-- | We convert from XML to the database by dropping the lines and
-- rotation number (which are specific to the games, not the teams
-- themselves).
xml_away_casinos :: [OddsGameCasinoXml] }
deriving (Eq, Show)
-instance FromXml OddsGameAwayTeamXml where
+instance ToDb OddsGameAwayTeamXml where
-- | The database representation of an 'OddsGameAwayTeamXml' is an
-- 'OddsGameTeam'.
--
type Db OddsGameAwayTeamXml = OddsGameTeam
+instance FromXml OddsGameAwayTeamXml where
-- | We convert from XML to the database by dropping the lines and
-- rotation number (which are specific to the games, not the teams
-- themselves).
xml_game_over_under_casinos = xml_casinos . xml_game_over_under
-instance FromXml OddsGameXml where
+instance ToDb OddsGameXml where
-- | The database representation of an 'OddsGameXml' is an
-- 'OddsGame'.
--
type Db OddsGameXml = OddsGame
+instance FromXml 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.
xml_games m = map game (xml_games_with_notes m)
-instance FromXml Message where
+instance ToDb Message where
-- | The database representation of a 'Message' is 'Odds'.
--
type Db Message = Odds
+instance FromXml Message where
-- | To convert from the XML representation to the database one, we
-- just drop a bunch of fields.
--