commit d570cc98a1cad2c52b0f360d77038c73ca0cfd34 Author: abearxiong Date: Sat Mar 22 10:55:35 2025 +0800 temp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ecff565 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +node_modules +dist diff --git a/package.json b/package.json new file mode 100644 index 0000000..4dba196 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "clickhouse-test", + "version": "0.0.1", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "ssh": "ssh -L 8123:127.0.0.1:8123 tencent" + }, + "keywords": [], + "author": "abearxiong (https://www.xiongxiao.me)", + "license": "MIT", + "packageManager": "pnpm@10.6.2", + "type": "module", + "dependencies": { + "@clickhouse/client": "^1.11.0", + "dotenv": "^16.4.7" + }, + "devDependencies": { + "@types/node": "^22.13.11", + "typescript": "^5.8.2" + } +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..3353289 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,65 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@clickhouse/client': + specifier: ^1.11.0 + version: 1.11.0 + dotenv: + specifier: ^16.4.7 + version: 16.4.7 + devDependencies: + '@types/node': + specifier: ^22.13.11 + version: 22.13.11 + typescript: + specifier: ^5.8.2 + version: 5.8.2 + +packages: + + '@clickhouse/client-common@1.11.0': + resolution: {integrity: sha512-O0xbwv7HiMXayokrf5dYIBpjBnYekcOXWz60T1cXLmiZ8vgrfNRCiOpybJkrMXKnw9D0mWCgPUu/rgMY7U1f4g==} + + '@clickhouse/client@1.11.0': + resolution: {integrity: sha512-VYTQfR0y/BtrIDEjuSce1zv85OvHak5sUhZVyNYJzbAgWHy3jFf8Os7FdUSeqyKav0xGGy+2X+dRanTFjI5Oug==} + engines: {node: '>=16'} + + '@types/node@22.13.11': + resolution: {integrity: sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==} + + dotenv@16.4.7: + resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + engines: {node: '>=12'} + + typescript@5.8.2: + resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + +snapshots: + + '@clickhouse/client-common@1.11.0': {} + + '@clickhouse/client@1.11.0': + dependencies: + '@clickhouse/client-common': 1.11.0 + + '@types/node@22.13.11': + dependencies: + undici-types: 6.20.0 + + dotenv@16.4.7: {} + + typescript@5.8.2: {} + + undici-types@6.20.0: {} diff --git a/src/app.ts b/src/app.ts new file mode 100644 index 0000000..8c9e37b --- /dev/null +++ b/src/app.ts @@ -0,0 +1,18 @@ +import dotenv from 'dotenv'; +import { createClient } from '@clickhouse/client'; + +dotenv.config(); + +const clickhouse = createClient({ + url: process.env.CLICKHOUSE_URL, + username: process.env.CLICKHOUSE_USERNAME, + password: process.env.CLICKHOUSE_PASSWORD, +}); + +clickhouse + .query({ + query: 'SELECT 1', + }) + .then((res) => { + console.log(res); + }); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..85e0150 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "nodenext", + "target": "esnext", + "noImplicitAny": false, + "outDir": "./dist", + "sourceMap": false, + "allowJs": true, + "newLine": "LF", + "baseUrl": "./", + "typeRoots": [ + "node_modules/@types", + ], + "declaration": true, + "noEmit": false, + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "moduleResolution": "NodeNext", + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "esModuleInterop": true, + "paths": { + "@/*": [ + "src/*" + ], + } + }, + "include": [ + "src/**/*.ts" + ], +} \ No newline at end of file