@biorate/clickhouse
v1.79.1
Published
Clickhouse connector
Downloads
35
Readme
Clickhouse
Clickhouse connector
Examples:
import { inject, container, Types, Core } from '@biorate/inversion';
import { IConfig, Config } from '@biorate/config';
import { ClickhouseConnector, ClickhouseConfig } from '@biorate/clickhouse';
class Root extends Core() {
@inject(ClickhouseConnector) public connector: ClickhouseConnector;
}
container.bind<IConfig>(Types.Config).to(Config).inSingletonScope();
container.bind<ClickhouseConnector>(ClickhouseConnector).toSelf().inSingletonScope();
container.bind<Root>(Root).toSelf().inSingletonScope();
container.get<IConfig>(Types.Config).merge({
Clickhouse: [
{
name: 'connection',
options: {},
},
],
});
(async () => {
const root = container.get<Root>(Root);
await root.$run();
const cursor = await root.connector
.get()
.query({ query: 'SELECT 1 AS result;', format: 'JSON' });
const { data } = await cursor.json<{ result: number }>();
console.log(data); // [{ result: 1 }]
})();
Learn
- Documentation can be found here - docs.
Release History
See the CHANGELOG
License
Copyright (c) 2021-present Leonid Levkin (llevkin)