Skip to content

Commit

Permalink
Cleanup unused interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
slvrtrn committed Mar 11, 2024
1 parent 19eb3dd commit 3c948d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
7 changes: 2 additions & 5 deletions packages/client-common/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ export interface QueryParams extends BaseQueryParams {
export type QueryParamsWithFormat<Format extends DataFormat> = Omit<
QueryParams,
'format'
> & { format: Format }

/** Same parameters as {@link QueryParams}, but with `format` field omitted */
export type QueryParamsWithoutFormat = Omit<QueryParams, 'format'>
> & { format?: Format }

export interface ExecParams extends BaseQueryParams {
/** Statement to execute. */
Expand Down Expand Up @@ -147,7 +144,7 @@ export class ClickHouseClient<Stream = unknown> {
* Returns an implementation of {@link BaseResultSet}.
*/
async query<Format extends DataFormat = 'JSON'>(
params: Omit<QueryParams, 'format'> & { format?: Format }
params: QueryParamsWithFormat<Format>
): Promise<BaseResultSet<Stream, Format>> {
const format = params.format ?? 'JSON'
const query = formatQuery(params.query, format)
Expand Down
2 changes: 1 addition & 1 deletion packages/client-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ export {
formatQuerySettings,
formatQueryParams,
} from './data_formatter'
export type { QueryParamsWithFormat, QueryParamsWithoutFormat } from './client'
export type { QueryParamsWithFormat } from './client'
7 changes: 5 additions & 2 deletions packages/client-node/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { DataFormat, QueryParams } from '@clickhouse/client-common'
import type {
DataFormat,
QueryParamsWithFormat,
} from '@clickhouse/client-common'
import { ClickHouseClient } from '@clickhouse/client-common'
import type Stream from 'stream'
import type { NodeClickHouseClientConfigOptions } from './config'
Expand All @@ -8,7 +11,7 @@ import type { ResultSet } from './result_set'
export class NodeClickHouseClient extends ClickHouseClient<Stream.Readable> {
/** See the base implementation: {@link ClickHouseClient.query} */
query<Format extends DataFormat = 'JSON'>(
params: Omit<QueryParams, 'format'> & { format?: Format }
params: QueryParamsWithFormat<Format>
): Promise<ResultSet<Format>> {
return super.query(params) as Promise<ResultSet<Format>>
}
Expand Down
4 changes: 2 additions & 2 deletions packages/client-web/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
InputJSONObjectEachRow,
InsertParams,
InsertResult,
QueryParams,
QueryParamsWithFormat,
} from '@clickhouse/client-common'
import { ClickHouseClient } from '@clickhouse/client-common'
import type { WebClickHouseClientConfigOptions } from './config'
Expand All @@ -27,7 +27,7 @@ export type WebClickHouseClient = Omit<WebClickHouseClientImpl, 'insert'> & {
class WebClickHouseClientImpl extends ClickHouseClient<ReadableStream> {
/** See the base implementation: {@link ClickHouseClient.query} */
query<Format extends DataFormat>(
params: Omit<QueryParams, 'format'> & { format?: Format }
params: QueryParamsWithFormat<Format>
): Promise<ResultSet<Format>> {
return super.query(params) as Promise<ResultSet<Format>>
}
Expand Down

0 comments on commit 3c948d0

Please sign in to comment.