+
+
+
+-- | A total copy of 'XmlImport' for instances of 'FromXmlFk'.
+--
+class (FromXmlFk a, PersistEntity (Db a)) => XmlImportFk a where
+ insert_xml_fk :: (PersistBackend m)
+ => DefaultKey (Parent a)
+ -> a
+ -> m (AutoKey (Db a))
+ insert_xml_fk fk x = insert $ from_xml_fk fk x
+
+ insert_xml_fk_ :: (PersistBackend m) => DefaultKey (Parent a) -> a -> m ()
+ insert_xml_fk_ fk x = insert_ $ from_xml_fk fk x
+
+ insertByAll_xml_fk :: (PersistBackend m)
+ => DefaultKey (Parent a)
+ -> a
+ -> m ( Either (AutoKey (Db a)) (AutoKey (Db a)) )
+ insertByAll_xml_fk fk x = insertByAll $ from_xml_fk fk x
+
+ insert_xml_or_select_fk :: (PersistBackend m)
+ => DefaultKey (Parent a)
+ -> a
+ -> m (AutoKey (Db a))
+ insert_xml_or_select_fk fk x = do
+ tmp <- insertByAll_xml_fk fk x
+ return $ (either id id) tmp