Add require_one: fetch exactly one row, error if none (#2974) (#3164)
Adds a non-optional counterpart to one(): where one() returns Option<Item>, require_one() returns Item directly and yields DbErr::RecordNotFound when no row matches, so call sites can use ? instead of unwrapping/matching an Option. This mirrors the fetch_one vs fetch_optional distinction common in other query APIs. Implemented on the base Selector and SelectorRaw executors, with ergonomic wrappers on Select, SelectTwo, and SelectTwoRequired. Mirrored to sea-orm-sync via make-sync.sh.
C
Chris Tsang committed
d0b8b2a632d5e7ff463b0c818d07dee11388a7f0
Parent: d7932d5
Committed by GitHub <noreply@github.com>
on 8/8/2026, 6:09:24 PM