rent
Concepts

Constraints, locks, and advanced SQL

Rent includes custom scalar IDs, compound unique constraints and upsert targets, composite join-table keys, foreign keys, cascades, SET NULL, unique/check constraints, typed tuple projections, aggregates, offset and keyset pagination, bounded streams, and SQL row-locking forms such as FOR UPDATE.

Generated upserts accept a field constant, or a tuple of field constants, as the conflict identity:

let membership = client
    .upsert_membership((
        membership::fields::USER_ID,
        membership::fields::GROUP_ID,
    ))
    .user_id(user.id)
    .group_id(group.id)
    .role("owner")
    .save()
    .await?;

The migration catalog covers multiple PostgreSQL schemas, indexes, foreign keys, checks, views, generated columns, triggers, extensions, RLS, and RLS policies. Raw SQL and the SQL AST remain available when an application intentionally leaves the generated surface.