@chkit/core 0.1.0-beta.4 → 0.1.0-beta.6

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.
Files changed (2) hide show
  1. package/README.md +57 -0
  2. package/package.json +1 -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.
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,6 @@
1
1
  {
2
2
  "name": "@chkit/core",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",