#crud #api

cruding_qs_list_filter

list filter parser implementation for the auto listing feature of cruding crate

7 releases

Uses new Rust 2024

0.4.3 Sep 29, 2025
0.4.2 Sep 29, 2025
0.3.0 Sep 26, 2025
0.2.2 Sep 24, 2025

#42 in #crud

Download history 225/week @ 2025-09-19 397/week @ 2025-09-26 279/week @ 2025-10-03 296/week @ 2025-10-10 139/week @ 2025-10-17 168/week @ 2025-10-24 406/week @ 2025-10-31

1,029 downloads per month
Used in 3 crates (2 directly)

MIT license

49KB
1.5K SLoC

TODOs

  • implement a worker that subscribes to WAL and has interface like: subscribe to these Models and these events and is responsible for parsing the WAL into some concrete rust struct
  • implement a worker that subscribes to redis topics
  • think of a way to solve workflows that should be done only once but many handlers could try doing it
    • gossip (all handlers share some state and coordinate)
    • specialized handlers (have specialized handlers that work in parallel to CRUD handlers)
  • implement automatic outbox table that registers events on commit using postgres constructs, example:
CREATE TABLE event_outbox (
  id           bigserial PRIMARY KEY,
  topic        text NOT NULL,           -- e.g., "customer:123"
  event_type   text NOT NULL,           -- e.g., "order.created"
  entity_id    text NOT NULL,
  payload      jsonb,                   -- keep small; enrich later
  commit_ts    timestamptz NOT NULL DEFAULT now(),
  published_at timestamptz
);

CREATE INDEX ON event_outbox (published_at) WHERE published_at IS NULL;

CREATE OR REPLACE FUNCTION orders_after_ins_outbox()
RETURNS trigger LANGUAGE plpgsql AS $$
BEGIN
  INSERT INTO event_outbox (topic, event_type, entity_id, payload)
  SELECT format('customer:%s', o.customer_id),
         'order.created',
         o.id::text,
         to_jsonb(o) - 'internal_field'
  FROM new_rows o;

  -- one poke per statement, not per row
  PERFORM pg_notify('outbox_poke', 'orders');
  RETURN NULL;
END$$;

CREATE TRIGGER orders_after_ins
AFTER INSERT ON orders
REFERENCING NEW TABLE AS new_rows
FOR EACH STATEMENT
EXECUTE FUNCTION orders_after_ins_outbox();
  • think of a way to implement notification for clients (for live updates)

Dependencies

~7.5MB
~139K SLoC