(
tag: T,
options:
| {
readonly Request: Schema.Schema<I, II, RI>
readonly execute: (
requests: Array<Types.NoInfer<II>>
) => Effect.Effect<ReadonlyArray<unknown>, E>
readonly withContext?: false
}
| {
readonly Request: Schema.Schema<I, II, RI>
readonly execute: (
requests: Array<Types.NoInfer<II>>
) => Effect.Effect<unknown, E, R>
readonly withContext: true
}
)
| 415 | return makeResolver(resolver, tag, options.Id, options.withContext) |
| 416 | } |
| 417 | const void_ = <T extends string, I, II, RI, E, R = never>( |
| 418 | tag: T, |
| 419 | options: |
| 420 | | { |
| 421 | readonly Request: Schema.Schema<I, II, RI> |
| 422 | readonly execute: ( |
| 423 | requests: Array<Types.NoInfer<II>> |
| 424 | ) => Effect.Effect<ReadonlyArray<unknown>, E> |
| 425 | readonly withContext?: false |
| 426 | } |
| 427 | | { |
| 428 | readonly Request: Schema.Schema<I, II, RI> |
| 429 | readonly execute: ( |
| 430 | requests: Array<Types.NoInfer<II>> |
| 431 | ) => Effect.Effect<unknown, E, R> |
| 432 | readonly withContext: true |
| 433 | } |
| 434 | ): Effect.Effect<SqlResolver<T, I, void, E, RI>, never, R> => { |
| 435 | const resolver = RequestResolver.makeBatched( |
| 436 | (requests: NonEmptyArray<SqlRequest<T, void, E>>) => { |
| 437 | const [inputs, spanLinks] = partitionRequests(requests) |
| 438 | return options.execute(inputs as any).pipe( |
| 439 | Effect.andThen( |
| 440 | Effect.forEach( |
| 441 | requests, |
| 442 | (request) => Request.complete(request, Exit.void), |
| 443 | { discard: true } |
| 444 | ) |
| 445 | ), |
| 446 | Effect.catchAllCause((cause) => |
| 447 | Effect.forEach( |
| 448 | requests, |
| 449 | (request) => Request.failCause(request, cause), |
| 450 | { discard: true } |
| 451 | ) |
| 452 | ), |
| 453 | Effect.withSpan(`sql.Resolver.batch ${tag}`, { |
| 454 | kind: "client", |
| 455 | links: spanLinks, |
| 456 | attributes: { "request.count": inputs.length }, |
| 457 | captureStackTrace: false |
| 458 | }) |
| 459 | ) as Effect.Effect<void> |
| 460 | } |
| 461 | ).identified(`@effect/sql/SqlResolver.void/${tag}`) |
| 462 | return makeResolver(resolver, tag, options.Request, options.withContext) |
| 463 | } |
| 464 | |
| 465 | export { |
| 466 | /** |
nothing calls this directly
no test coverage detected