Skip to content

Commit 6dfbcbc

Browse files
authored
Change bigint serialization in hashQuery function
1 parent e551ef8 commit 6dfbcbc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drizzle-orm/src/cache/core/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const strategyFor = async (
103103
export type MutationOption = { tags?: string | string[]; tables?: Table<any> | Table<any>[] | string | string[] };
104104

105105
export async function hashQuery(sql: string, params?: any[]) {
106-
const dataToHash = `${sql}-${JSON.stringify(params, (_, v) => typeof v === 'bigint' ? v.toString() : v)}`;
106+
const dataToHash = `${sql}-${JSON.stringify(params, (_, v) => typeof v === 'bigint' ? `${v}n` : v)}`;
107107
const encoder = new TextEncoder();
108108
const data = encoder.encode(dataToHash);
109109
const hashBuffer = await crypto.subtle.digest('SHA-256', data);

0 commit comments

Comments
 (0)