Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
tr-nestjs-clickhouse
Advanced tools
NodeJS client for ClickHouse. Send query over HTTP interface use nestjs-clickhouse library
Yarn
yarn add tr@nestjs-clickhouse
NPM
npm install tr@nestjs-clickhouse --save
Let's register the ClickHouseModule in app.module.ts
import { Module } from '@nestjs/common'
import { ClickHouseModule} from 'tr@nestjs-clickhouse'
@Module({
imports: [
ClickHouseModule.forRoot({
url: 'http://localhost',
port: 8123,
debug: true,
database: 'gettingstarted',
}),
],
})
export class AppModule {}
With Async
import { Module } from '@nestjs/common';
import { RedisModule} from 'nestjs-redis'
@Module({
imports: [
RedisModule.forRootAsync({
useFactory: (configService: ConfigService) => ({
url: 'http://localhost',
port: 8123,
debug: true,
database: 'gettingstarted',
}),
inject:[ConfigService]
}),
],
})
export class AppModule {}
And use in your service
import { Injectable } from '@nestjs/common';
import { ClickHouseRegistry } from 'tr@nestjs-clickhouse';
@Injectable()
export class TestService {
constructor(
private readonly clickHouseRegistry: ClickHouseRegistry
) { }
async query(query: string, reqParams?: any) {
return this.clickHouseRegistry.query(query, reqParams);
}
async insert(query: string, data?: any) {
return this.clickHouseRegistry.insert(query, data);
}
}
Options
export interface ClickHouseOptions {
url?: string;
port?: number;
debug?: boolean;
database?: string;
basicAuth?: BasicAuth;
isUseGzip?: boolean;
trimQuery?: boolean;
usePost?: boolean;
format?: string; // "json" || "csv" || "tsv"
raw?: string;
config?: Config;
reqParams?: ReqParams;
}
type BasicAuth = {
username: string;
password: string;
};
type Config = {
session_id: string;
session_timeout: number;
output_format_json_quote_64bit_integers: number;
enable_http_compression: number;
database: string;
};
type ReqParams = unknown;
That's it!
FAQs
NodeJS client for ClickHouse. Send query over HTTP interface.
The npm package tr-nestjs-clickhouse receives a total of 92 weekly downloads. As such, tr-nestjs-clickhouse popularity was classified as not popular.
We found that tr-nestjs-clickhouse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.