From de26f5fd007cf42eae8142cc366a3f89bfef2abc Mon Sep 17 00:00:00 2001 From: Spencer Torres Date: Wed, 29 Nov 2023 10:25:53 -0500 Subject: [PATCH] move limit function in sqlGenerator --- src/data/sqlGenerator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/sqlGenerator.ts b/src/data/sqlGenerator.ts index 2d79d55a..bb8d0a51 100644 --- a/src/data/sqlGenerator.ts +++ b/src/data/sqlGenerator.ts @@ -19,7 +19,6 @@ export const generateSql = (options: QueryBuilderOptions): string => { */ const generateTraceQuery = (options: QueryBuilderOptions): string => { const { database, table } = options; - const limit = getLimit(options.limit); const queryParts: string[] = []; @@ -98,6 +97,7 @@ const generateTraceQuery = (options: QueryBuilderOptions): string => { queryParts.push('ORDER BY startTime ASC'); } + const limit = getLimit(options.limit); if (limit !== '') { queryParts.push(limit); } @@ -114,7 +114,6 @@ const generateTraceQuery = (options: QueryBuilderOptions): string => { */ const generateLogsQuery = (options: QueryBuilderOptions): string => { const { database, table } = options; - const limit = getLimit(options.limit); const queryParts: string[] = []; @@ -162,6 +161,7 @@ const generateLogsQuery = (options: QueryBuilderOptions): string => { queryParts.push(getOrderBy(options.orderBy, false)); } + const limit = getLimit(options.limit); if (limit !== '') { queryParts.push(limit); }