Skip to content

Commit 2f20087

Browse files
committed
chore: debug libsql timing
1 parent e345fdc commit 2f20087

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/runtime/adapters/libsql.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ export default createDatabaseAdapter<{ url: string, authToken: string }>((opts)
1212

1313
return {
1414
async all<T>(sql: string, params?: Array<number | string | boolean>): Promise<T[]> {
15+
const now = Date.now()
1516
const res = await client.execute({ sql, args: params || [] })
16-
17+
console.log(`[all] ${res.rows.length} rows in ${Date.now() - now}ms`)
1718
return res.rows as T[]
1819
},
1920
async first<T>(sql: string, params?: Array<number | string | boolean>) {
21+
const now = Date.now()
2022
const res = await client.execute({ sql, args: params || [] })
21-
23+
console.log(`[first] ${JSON.stringify(res.rows[0])} in ${Date.now() - now}ms`)
2224
return res.rows[0] as T
2325
},
2426
async exec(sql: string): Promise<void> {

0 commit comments

Comments
 (0)