Skip to content

Commit

Permalink
use insert batch
Browse files Browse the repository at this point in the history
  • Loading branch information
jnetoatbliss committed Mar 3, 2023
1 parent f0b9bb0 commit 84cbd8d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/manager/Controllers/ApodManagerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ public class ApodManagerController {

private func saveItems(_ items: [NasaApodDto]?) async throws {
let itemsAdd: [ApodStorage] = items?.map { ApodStorage($0) } ?? []
for item in itemsAdd {
try await storageController.asyncSaveItem(item)
}
try storageController.saveItemsSql(itemsAdd)
self.items = try getAll()?.mapToEntity()
// for item in itemsAdd {
// try await storageController.asyncSaveItem(item)
// }
}
}

0 comments on commit 84cbd8d

Please sign in to comment.