Skip to content

Instantly share code, notes, and snippets.

@kansson
Created January 28, 2024 22:40
Show Gist options
  • Save kansson/004f88f7927777d03def1156d000b872 to your computer and use it in GitHub Desktop.
Save kansson/004f88f7927777d03def1156d000b872 to your computer and use it in GitHub Desktop.
Drizzle ORM Bun Patch
diff --git a/node_modules/drizzle-orm/bun-sqlite/session.js b/node_modules/drizzle-orm/bun-sqlite/session.js
index ce48d1a..50a5b4f 100644
--- a/node_modules/drizzle-orm/bun-sqlite/session.js
+++ b/node_modules/drizzle-orm/bun-sqlite/session.js
@@ -76,14 +76,14 @@ class PreparedQuery extends PreparedQueryBase {
get(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
- const row = this.stmt.get(...params);
+ const { fields, joinsNotNullableMap, customResultMapper, stmt } = this;
+ if (!fields && !customResultMapper) {
+ return stmt.get(...params);
+ }
+ const row = stmt.values(...params)[0];
if (!row) {
return void 0;
}
- const { fields, joinsNotNullableMap, customResultMapper } = this;
- if (!fields && !customResultMapper) {
- return row;
- }
if (customResultMapper) {
return customResultMapper([row]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment