deno.land / x / pg_mem@2.8.1 / schema / information-schema / table-list.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { _ITable, _ISelection, IValue, _IIndex, _IDb, IndexKey, setId, _ISchema, _Transaction, _Explainer } from '../../interfaces-private.ts';import { Schema, nil } from '../../interfaces.ts';import { Types } from '../../datatypes/index.ts';import { TableIndex } from '../table-index.ts';import { ReadOnlyTable } from '../readonly-table.ts';
const IS_SCHEMA = Symbol('_is_schema');export class TablesSchema extends ReadOnlyTable implements _ITable {
get ownSymbol() { return IS_SCHEMA; }
isOriginOf(v: IValue): boolean { return v.origin === this || v.origin === this.selection; }
_schema: Schema = { name: 'tables', fields: [ { name: 'table_catalog', type: Types.text() } , { name: 'table_schema', type: Types.text() } , { name: 'table_name', type: Types.text() } , { name: 'table_type', type: Types.text() } , { name: 'self_referencing_column_name', type: Types.text() } , { name: 'reference_generation', type: Types.text() } , { name: 'user_defined_type_catalog', type: Types.text() } , { name: 'user_defined_type_schema', type: Types.text() } , { name: 'user_defined_type_name', type: Types.text() } , { name: 'is_insertable_into', type: Types.text(3) } , { name: 'is_typed', type: Types.text(3) } , { name: 'commit_action', type: Types.text() } ] };
entropy(t: _Transaction): number { return this.db.listSchemas() .reduce((tot, s) => tot + s.tablesCount(t), 0); }
*enumerate(t: _Transaction) { for (const s of this.db.listSchemas()) { for (const it of s.listTables(t)) { yield this.make(it); } } }
make(t: _ITable<any>): any { if (!t) { return null; } const ret = { table_catalog: 'pgmem', table_schema: 'public', table_name: t.name, table_type: 'BASE TABLE', self_referencing_column_name: null, reference_generation: null, user_defined_type_catalog: null, user_defined_type_schema: null, user_defined_type_name: null, is_insertable_into: 'YES', is_typed: 'NO', commit_action: null, [IS_SCHEMA]: true, }; setId(ret, '/schema/table/' + t.name); return ret; }
hasItem(value: any): boolean { return !!value?.[IS_SCHEMA]; }
getIndex(forValue: IValue<any>): _IIndex<any> | nil { if (forValue?.id === 'table_name') { return new TableIndex(this, forValue); } return null; }
}
pg_mem

Version Info

Tagged at
a year ago