April 2020
Intermediate to advanced
292 pages
6h 50m
English
All of our read functions will sit in a file that exports a dependency-receiving function that captures the database connection. Let’s write that shell now:
| | function createRead ({ db }) { |
| | return { |
| | } |
| | } |
| | |
| | module.exports = exports = createRead |
It receives the db and returns… something. Let’s define that something.
Eventide provides a function to get the last message from a stream.[42] It’s signature is as follows:
| | CREATE OR REPLACE FUNCTION get_last_stream_message( |
| | stream_name varchar |
| | ) |
It just takes a stream name. Here’s some JavaScript to wrap that for our project:
| | const deserializeMessage = require( ... |
Read now
Unlock full access