Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/mostlyobvious/En57. DCB-compatible event store library in Ruby with support for PostgreSQL.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637TRUNCATE TABLE en57.tags, en57.events RESTART IDENTITY CASCADE;
INSERT INTO en57.events (id, type, data, meta)VALUES ('00000000-0000-0000-0000-000000000001', 'OrderPlaced', '{}'::jsonb, '{}'::jsonb), ('00000000-0000-0000-0000-000000000002', 'OrderPlaced', '{}'::jsonb, '{}'::jsonb), ('00000000-0000-0000-0000-000000000003', 'OrderPlaced', '{}'::jsonb, '{}'::jsonb), ('00000000-0000-0000-0000-000000000004', 'OrderPlaced', '{}'::jsonb, '{}'::jsonb), ('00000000-0000-0000-0000-000000000005', 'OrderPlaced', '{}'::jsonb, '{}'::jsonb);
-- batch_size caps the number of rows returned (first keyset page)SELECT position, id::textFROM en57.read_events (ARRAY[]::jsonb[], 2)ORDER BY position;
-- after_position is a keyset cursor; combined with batch_size it yields the next pageSELECT position, id::textFROM en57.read_events (ARRAY[]::jsonb[], 2, 2)ORDER BY position;
-- a cursor at or past the last position returns no further rowsSELECT position, id::textFROM en57.read_events (ARRAY[]::jsonb[], 2, 5)ORDER BY position;