dyedgreen / deno-sqlite

Deno SQLite module
https://deno.land/x/sqlite
MIT License
409 stars 36 forks source link

Add `first` and deprecated `one` #206

Closed dyedgreen closed 2 years ago

dyedgreen commented 2 years ago

Remove one and add first. The previous behavior can roughly be emulated with

const row = query.first();
if (!row) throw new Error("Missing row");

(This drops the check for returning no more than one row, but that check does not matter in most cases, and when it matters should probably be tested for explicitly)