Skip to content

Commit 16e6d51

Browse files
committed
Merge branch 'beta' of https://github.com/drizzle-team/drizzle-orm into beta
2 parents ad2d40a + c4f81a0 commit 16e6d51

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drizzle-orm/src/aws-data-api/pg/session.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,17 @@ export class AwsDataApiSession<
289289
);
290290
}
291291

292+
override async count(sql: SQL): Promise<number> {
293+
const query = this.dialect.sqlToQuery(sql);
294+
const prepared = this.prepareQuery(query, undefined, undefined, true);
295+
296+
const { rows } = await prepared.values();
297+
const count = rows[0]?.[0] ?? 0;
298+
299+
if (typeof count === 'number') return count;
300+
return Number(count);
301+
}
302+
292303
override execute<T>(query: SQL): Promise<T> {
293304
return this.prepareQuery<PreparedQueryConfig & { execute: T; values: AwsDataApiPgQueryResult<unknown[]> }>(
294305
this.dialect.sqlToQuery(query),

integration-tests/tests/relational/singlestore.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,6 +3786,9 @@ test('Get user with invitee and posts + limit posts and users + where', async ()
37863786
ownerId: 3,
37873787
},
37883788
limit: 1,
3789+
orderBy: {
3790+
id: 'asc',
3791+
},
37893792
},
37903793
},
37913794
orderBy: {

0 commit comments

Comments
 (0)