为核心数据中的关系实现批量更新

时间:2019-01-24 13:52:54

标签: ios swift core-data nsbatchupdaterequest

我正在尝试使用getZipSink更新实体的属性及其关系,根据Apple的文档,我们可以使用retrieveSmaXtec :: Path Abs Dir -> IO (Vector SxRecord) retrieveSmaXtec sxDir = do rows <- sourceDirectoryDeep False (fromAbsDir sxDir) .| getZipSink (combine <$> ZipSink processFileName <*> ZipSink processCSV ) & runConduitRes print rows rows & fmap fromRow & catMaybes & return where combine :: (Vector (MapRow Text)) -> (Vector (MapRow Text)) -> (Vector (MapRow Text)) combine v1 v2 = (uncurry DM.union) <$> (zip v1 v2) processCSV :: (MonadResource m, MonadThrow m, PrimMonad m)=> ConduitT FilePath Void m (Vector ((MapRow Text))) processCSV = mapMC (liftIO . DTIO.readFile) .| intoCSV defCSVSettings .| sinkVector processFileName :: (MonadResource m, MonadThrow m, PrimMonad m) => ConduitT FilePath Void m (Vector ((MapRow Text))) processFileName = mapC go .| sinkVector where go :: FilePath -> MapRow Text go fp = takeFileName fp & takeWhile (/= '.') & splitOn "_" & fmap Txt.pack & zip colNames & DM.fromList colNames = [markKey, idKey] 更新属性。但是我在import Conduit import qualified Data.Conduit.Combinators as DCC import Data.CSV.Conduit import Data.Function ((&)) import Data.List.Split (splitOn) import Data.Map as DM import Data.Text (Text) import qualified Data.Text as Txt import qualified Data.Text.IO as DTIO import Data.Vector (Vector) import Path import System.FilePath.Posix 上附加了NSBatchUpdateRequest,还需要根据新的响应进行更新,

回复:

propertiesToUpdate

ORAFieldMetadataMO

代码:

relationship

根据文档,

  

批处理更新不能用于更改关系,删除实体或创建新实体。要开始批量更新,请创建一个NSBatchUpdateRequest对象,该对象与NSFetchRequest具有许多相似之处。

如何在此处更新Entity关系?

0 个答案:

没有答案