Closed oskardudycz closed 3 months ago
Generalised also projection definition.
Made postgreSQLProjection and inlineProjection obsolete, use postgreSQLProjection and postgreSQLInlineProjection instead.
postgreSQLProjection
inlineProjection
postgreSQLInlineProjection
Now you can use the new projections raw projection as:
import { postgreSQLRawSQLProjection } from '@event-driven-io/emmett-postgresql'; const rawSQLProjection = postgreSQLRawSQLProjection<ProductItemAdded>({ name: 'customProjection', canHandle: ['ProductItemAdded'], handle: (event, context) => sql('INSERT INTO product_items VALUES(%s, %L, %L)', event.productId, event.quantity)) });
There's also postgreSQLRawBatchSQLProjection that handles a batch of events accordingly. Both can be sync or async. You can access and query the database through the context handler param.
postgreSQLRawBatchSQLProjection
context
Fixes #97
@jameswoodley FYI
Generalised also projection definition.
Made
postgreSQLProjection
andinlineProjection
obsolete, usepostgreSQLProjection
andpostgreSQLInlineProjection
instead.Now you can use the new projections raw projection as:
There's also
postgreSQLRawBatchSQLProjection
that handles a batch of events accordingly. Both can be sync or async. You can access and query the database through thecontext
handler param.Fixes #97