Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
drizzle-condition
Advanced tools
An alternative, intuitive way to declare drizzle SQL conditions
Simple utilities to define a drizzle-orm condition, without having to import the individual comparator functions. Instead use a single function with logical comparison operators to define the condition.
[!Warning] This library is a work in progress, and is not yet ready for production use.
Install the package from npm:
npm install drizzle-condition
import { integer, sqliteTable } from "drizzle-orm/sqlite-core";
import { condition } from "drizzle-condition";
const myTable = sqliteTable("my_table", {
id: integer("id"),
});
const myQuery = await myDatabaseConnection.query.myTable.findMany({
// where: eq(myTable.id, 1), <-- drizzle-orm implementation eq, gt, lt, etc
where: condition(myTable.id, "==", 1),// <-- drizzle-condition implementation '==', '!=', '>', '<', '>=', '<=' etc
});
I enjoy using the mathmatical operator syntax when building queries, much like firebase and other ORMs, and found myself writing helpers in all my projects to write the queries in this format.
Hopefully this library will make it easier for you to write queries this way too.
drizzle-orm | drizzle-condition |
---|---|
eq | condition(table.column, "==", value) |
ne | ⏱️ todo |
gt | ⏱️ todo |
lt | ⏱️ todo |
gte | ⏱️ todo |
lte | ⏱️ todo |
in | ⏱️ todo |
isNull | ⏱️ todo |
isNotNull | ⏱️ todo |
inArray | ⏱️ todo |
notInArray | ⏱️ todo |
exists | ⏱️ todo |
notExists | ⏱️ todo |
between | ⏱️ todo |
notBetween | ⏱️ todo |
like | ⏱️ todo |
notLike | ⏱️ todo |
ilike | ⏱️ todo |
notIlike | ⏱️ todo |
not | ⏱️ todo |
and | ⏱️ todo |
or | ⏱️ todo |
arrayContains | ⏱️ todo |
arrayContainedIn | ⏱️ todo |
arrayOverlaps | ⏱️ todo |
Contributions are welcome!
Package manager: bun Test runner: vitest Linter: biome
bun install
bun run all
package.json
for more details.Create a pull request to the main
branch from your forked repository.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
An alternative, intuitive way to declare drizzle SQL conditions
We found that drizzle-condition demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.