@visorcraft/mongreldb 0.20.0 → 0.21.0
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 +7 -0
- package/mongreldb.linux-x64-gnu.node +0 -0
- package/native.d.ts +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,13 @@ class Database {
|
|
|
29
29
|
createTable(name: string, schema: SchemaSpec): bigint
|
|
30
30
|
table(name: string): TableHandle
|
|
31
31
|
begin(): Transaction
|
|
32
|
+
createProcedure(spec: ProcedureSpec): bigint
|
|
33
|
+
createOrReplaceProcedure(spec: ProcedureSpec): bigint
|
|
34
|
+
dropProcedure(name: string): void
|
|
35
|
+
procedures(): ProcedureInfo[]
|
|
36
|
+
procedure(name: string): ProcedureInfo | null
|
|
37
|
+
callProcedure(name: string, opts?: ProcedureCallOptions): ProcedureCallResult
|
|
38
|
+
callProcedureAsync(name: string, opts?: ProcedureCallOptions): Promise<ProcedureCallResult>
|
|
32
39
|
sql(sql: string): Promise<Buffer>
|
|
33
40
|
close(): void
|
|
34
41
|
}
|
|
Binary file
|
package/native.d.ts
CHANGED
|
@@ -53,10 +53,31 @@ export interface IndexSpec {
|
|
|
53
53
|
columnId: number
|
|
54
54
|
kind: IndexKindSpec
|
|
55
55
|
}
|
|
56
|
+
/** Result of a `compactAll` operation. */
|
|
57
|
+
export interface CompactStats {
|
|
58
|
+
/** Number of tables that were merged into a single run. */
|
|
59
|
+
compacted: number
|
|
60
|
+
/** Number of tables skipped (fewer than 2 runs, or compaction failed). */
|
|
61
|
+
skipped: number
|
|
62
|
+
}
|
|
56
63
|
export interface SchemaSpec {
|
|
57
64
|
columns: Array<ColumnSpec>
|
|
58
65
|
indexes: Array<IndexSpec>
|
|
59
66
|
}
|
|
67
|
+
export interface ProcedureSpec {
|
|
68
|
+
json: string
|
|
69
|
+
}
|
|
70
|
+
export interface ProcedureInfo {
|
|
71
|
+
json: string
|
|
72
|
+
}
|
|
73
|
+
export interface ProcedureCallOptions {
|
|
74
|
+
argsJson?: string
|
|
75
|
+
idempotencyKey?: string
|
|
76
|
+
}
|
|
77
|
+
export interface ProcedureCallResult {
|
|
78
|
+
epoch?: bigint
|
|
79
|
+
resultJson: string
|
|
80
|
+
}
|
|
60
81
|
/**
|
|
61
82
|
* A single cell value. Only the field matching the column type is read; the
|
|
62
83
|
* rest are ignored. `bytes` is raw; `text` is UTF-8 (use for `Bytes` columns
|
|
@@ -191,6 +212,13 @@ export declare class Database {
|
|
|
191
212
|
snapshotEpoch(): bigint
|
|
192
213
|
/** List all live table names. */
|
|
193
214
|
tableNames(): Array<string>
|
|
215
|
+
createProcedure(spec: ProcedureSpec): bigint
|
|
216
|
+
createOrReplaceProcedure(spec: ProcedureSpec): bigint
|
|
217
|
+
dropProcedure(name: string): void
|
|
218
|
+
procedures(): Array<ProcedureInfo>
|
|
219
|
+
procedure(name: string): ProcedureInfo | null
|
|
220
|
+
callProcedure(name: string, opts?: ProcedureCallOptions | undefined | null): ProcedureCallResult
|
|
221
|
+
callProcedureAsync(name: string, opts?: ProcedureCallOptions | undefined | null): Promise<ProcedureCallResult>
|
|
194
222
|
/**
|
|
195
223
|
* Return the column names of a table as it exists in the **database**
|
|
196
224
|
* (not the code-defined schema). Lets migrations check whether a column
|
|
@@ -212,6 +240,16 @@ export declare class Database {
|
|
|
212
240
|
check(): string
|
|
213
241
|
/** Repair/quarantine corrupt tables. Returns a JSON-string summary. */
|
|
214
242
|
doctor(): string
|
|
243
|
+
/**
|
|
244
|
+
* Compact every table: merge sorted runs into one clean run each so
|
|
245
|
+
* query latency stays flat. Tables with fewer than two runs are skipped.
|
|
246
|
+
*/
|
|
247
|
+
compactAll(): CompactStats
|
|
248
|
+
/**
|
|
249
|
+
* Compact a single table by name. Returns `true` if compacted, `false`
|
|
250
|
+
* if skipped (fewer than two runs).
|
|
251
|
+
*/
|
|
252
|
+
compactTable(name: string): boolean
|
|
215
253
|
/** Return the path passed to `withPath` / `open`. */
|
|
216
254
|
directory(): string
|
|
217
255
|
/** Run a cross-table SQL query. Returns Arrow IPC bytes. */
|
|
@@ -423,4 +461,7 @@ export declare class RemoteDatabase {
|
|
|
423
461
|
count(table: string): number
|
|
424
462
|
sql(sql: string): Buffer
|
|
425
463
|
commit(table: string): bigint
|
|
464
|
+
createProcedure(spec: ProcedureSpec): string
|
|
465
|
+
dropProcedure(name: string): void
|
|
466
|
+
callProcedure(name: string, opts?: ProcedureCallOptions | undefined | null): string
|
|
426
467
|
}
|
package/package.json
CHANGED