
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
sqlite-cloudflare-d1
Advanced tools
Ergonomic interface for writing sqlite queries against cloudflare d1
This library provides a minimal and flexible interface for cloudflare d1.
The CURD operations are supported.
Inserts a single row into and returns the inserted row.
Example:
insert(db, {
into: "users",
data: { name: "bob", age: 30 }
});
// { id: 1, name: "bob", age: 30 }
Query database for one or more rows. See the last example on how to join tables.
Example 1: Returns every row in albums table.
await query(db, { from: "albums" });
// [{id: 1, title: "Carry On"}, ...]
Example 2: Returns every album that starts with "Carry".
await query(db, {
from: "albums",
where: {
"Title LIKE ?": "Carry%",
},
});
// [{id: 1, title: "Carry On"}]
Example 3: A more complex query. Note that in "where" clauses objects mean "AND" and arrays mean "OR".
await query(db, {
from: "albums",
where: [
{ Title: "Transmission" },
{
"Title LIKE ?": "%On",
"ArtistId > ?": 57,
},
],
});
// This would effectively run the following query:
// "SELECT * FROM albums WHERE (Title = ?) OR (Title LIKE ? AND ArtisID > ?)"
Example 4: A join example with select and group by.
await query(db, {
select: {
"a.Name": "Name",
"count(*)": "count",
},
from: "artists a join albums b on a.ArtistId = b.ArtistId",
group_by: "a.ArtistId",
having: { "count > ?": 12 },
});
Update the matching rows to the given values. Similar to other functions, update returns the affected rows.
Example:
await update(db, {
table: "albums",
where: { title: "Carry On" },
set: { title: "Carry On!" },
});
// [{id: 1, title: "Carry On!"}]
Remove one or more rows from a table, and returns the deleted rows.
Example 1: Deletes every row that matches the condition.
await remove(db, {
from: "albums",
where: { title: "Carry On" },
});
// [{id: 1, title: "Carry On"}]
Example 1: The keys are expressions and they reference the values by "?". Object keys are "AND"ed together.
query({ ...,
where: {
name: "bob",
"age > ?": 31,
}
})
// { sql: "name = ? AND age > ?", values: ["bob", 31] }
Example 2: Arrays represent an "OR".
query({ ...
[
{
"name LIKE ?": "Frank%",
"age > ?": 31,
},
{ height: 181 },
]
})
// { sql: "(name = ? AND age > ?) OR (height = ?)", values: ["Frank%", 31, 181] }
Note that height: 31 is a shorthand for "height = ?": 31.
FAQs
Ergonomic interface for writing sqlite queries against cloudflare d1
We found that sqlite-cloudflare-d1 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.