@chkit/core 0.1.0-beta.5 → 0.1.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -0
- package/package.json +7 -1
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @chkit/core
|
|
2
|
+
|
|
3
|
+
Schema DSL, configuration, and diff engine for chkit.
|
|
4
|
+
|
|
5
|
+
Part of the [chkit](https://github.com/obsessiondb/chkit) monorepo. This package is typically used together with the [`chkit`](https://www.npmjs.com/package/chkit) CLI.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @chkit/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Define your ClickHouse schema in TypeScript:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { defineConfig, schema, table, view, materializedView } from '@chkit/core'
|
|
19
|
+
|
|
20
|
+
const events = table({
|
|
21
|
+
database: 'default',
|
|
22
|
+
name: 'events',
|
|
23
|
+
engine: 'MergeTree',
|
|
24
|
+
columns: [
|
|
25
|
+
{ name: 'id', type: 'UInt64' },
|
|
26
|
+
{ name: 'source', type: 'String' },
|
|
27
|
+
{ name: 'ingested_at', type: 'DateTime64(3)', default: 'fn:now64(3)' },
|
|
28
|
+
],
|
|
29
|
+
primaryKey: ['id'],
|
|
30
|
+
orderBy: ['id'],
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export default schema(events)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Configure your project:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// clickhouse.config.ts
|
|
40
|
+
import { defineConfig } from '@chkit/core'
|
|
41
|
+
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
schema: './src/db/schema/**/*.ts',
|
|
44
|
+
outDir: './chkit',
|
|
45
|
+
clickhouse: {
|
|
46
|
+
url: process.env.CLICKHOUSE_URL ?? 'http://localhost:8123',
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
See the [chkit documentation](https://chkit.obsessiondb.com).
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chkit/core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
|
+
"homepage": "https://chkit.obsessiondb.com",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/obsessiondb/chkit.git",
|
|
8
|
+
"directory": "packages/core"
|
|
9
|
+
},
|
|
4
10
|
"type": "module",
|
|
5
11
|
"main": "./dist/index.js",
|
|
6
12
|
"types": "./dist/index.d.ts",
|