Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/sqlite/mod.ts>DB#queryEntries

Deno SQLite module
Go to Latest
method DB.prototype.queryEntries
import { DB } from "https://deno.land/x/sqlite@v3.7.0/mod.ts";

Like query except each row is returned as an object containing key-value pairs.

Examples

const rows = db.queryEntries<{ name: string, age: number }>("SELECT name, age FROM people");
// rows = [{ name: "Peter Parker", age: 21 }, ...]
const rows = db.queryEntries<{ name: string, age: number }>(
  "SELECT name, age FROM people WHERE age >= :minAge",
  { minAge },
 );
// rows = [{ name: "Peter Parker", age: 21 }, ...]

Parameters

sql: string
optional
params: QueryParameterSet

Returns

Array<O>