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

Class OrderRepo

packages/infra/test/rawQuery.test.ts:533–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531
532// @effect-diagnostics-next-line missingEffectServiceDependency:off
533class OrderRepo extends Context.Service<OrderRepo>()(
534 "OrderRepo",
535 {
536 make: Effect.gen(function*() {
537 const partitionKey = "orders-" + new Date().getTime()
538 return yield* makeRepo("Order", Order, { config: { partitionValue: () => partitionKey } })
539 })
540 }
541) {
542 static readonly layer = Layer
543 .effect(
544 OrderRepo,
545 Effect.gen(function*() {
546 const partitionKey = "orders-" + new Date().getTime()
547 const repo = OrderRepo.of(
548 yield* makeRepo("Order", Order, {
549 config: { partitionValue: () => partitionKey }
550 })
551 )
552 yield* repo.saveAndPublish(orderItems).pipe(setupRequestContextFromCurrent("init"))
553 return repo
554 })
555 )
556 static readonly Test = this
557 .layer
558 .pipe(Layer.provide(Layer.merge(MemoryStoreLive, RepositoryRegistryLive)))
559
560 static readonly TestSqlite = this
561 .layer
562 .pipe(
563 Layer.provide(
564 Layer.merge(
565 SQLiteStoreLayer({
566 url: Redacted.make("sqlite://"),
567 prefix: "test_",
568 dbName: "test"
569 }),
570 RepositoryRegistryLive
571 )
572 ),
573 Layer.provide(SqliteClient.layer({ filename: ":memory:" }))
574 )
575}
576
577describe("scanner-style AllPickList computed projections", () => {
578 const test = Effect

Callers

nothing calls this directly

Calls 8

makeRepoFunction · 0.90
SQLiteStoreLayerFunction · 0.85
mergeMethod · 0.80
ofMethod · 0.65
pipeMethod · 0.65
makeMethod · 0.65
provideMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…