Skip to main content

enqueue_event_outbox

Function enqueue_event_outbox 

Source
pub async fn enqueue_event_outbox<'e, E, T>(
    executor: E,
    model: &str,
    operation: ModelEventKind,
    data: &T,
) -> Result<(), CratestackError>
where E: Executor<'e, Database = Postgres>, T: Serialize,
Expand description

Inserts one cratestack_event_outbox row. pub for the same reason as ensure_event_outbox_table — see its doc comment.

model takes &str rather than the &'static str every in-crate caller happens to pass (generated code’s model names are always &'static str literals): cratestack-studio parses .cstack schemas at runtime, so its model names are owned Strings with no 'static lifetime available. The function only ever borrows model long enough to bind it as a query parameter, so relaxing the bound costs nothing for the existing callers and is required for the new one.