MCPcopy Create free account
hub / github.com/effect-app/libs / saveManyWithPureBatched_

Function saveManyWithPureBatched_

packages/effect-app/src/Model/Repository/ext.ts:96–114  ·  view source on GitHub ↗
(
    items: Iterable<S1>,
    pure: Effect.Effect<A, E, FixEnv<R, Evt, readonly S1[], readonly S2[]>>,
    batchSize = 100
  )

Source from the content-addressed store, hash-verified

94 E | InvalidStateError | OptimisticConcurrencyException | DatabaseError,
95 R | RSchema | RPublish
96 > {
97 return Effect.flatMap(gen, ([items, events, a]) => repo.saveAndPublish(items, events).pipe(Effect.map(() => a)))
98 }
99
100 function saveManyWithPureBatched_<
101 R,
102 A,
103 E,
104 S1 extends T,
105 S2 extends T
106 >(
107 items: Iterable<S1>,
108 pure: Effect.Effect<A, E, FixEnv<R, Evt, readonly S1[], readonly S2[]>>,
109 batchSize = 100
110 ) {
111 return Effect.forEach(
112 Array.chunksOf(items, batchSize),
113 (batch) =>
114 saveAllWithEffectInt(
115 runTerm(pure, batch)
116 )
117 )

Callers 1

queryAndSavePureFunction · 0.85

Calls 3

runTermFunction · 0.90
saveAllWithEffectIntFunction · 0.85
forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…