MCPcopy
hub / github.com/drizzle-team/drizzle-orm / Table

Class Table

drizzle-orm/src/table.ts:49–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49export class Table<T extends TableConfig = TableConfig> implements SQLWrapper {
50 static readonly [entityKind]: string = 'Table';
51
52 declare readonly _: {
53 readonly brand: 'Table';
54 readonly config: T;
55 readonly name: T['name'];
56 readonly schema: T['schema'];
57 readonly columns: T['columns'];
58 readonly inferSelect: InferSelectModel<Table<T>>;
59 readonly inferInsert: InferInsertModel<Table<T>>;
60 };
61
62 declare readonly $inferSelect: InferSelectModel<Table<T>>;
63 declare readonly $inferInsert: InferInsertModel<Table<T>>;
64
65 /** @internal */
66 static readonly Symbol = {
67 Name: TableName as typeof TableName,
68 Schema: Schema as typeof Schema,
69 OriginalName: OriginalName as typeof OriginalName,
70 Columns: Columns as typeof Columns,
71 ExtraConfigColumns: ExtraConfigColumns as typeof ExtraConfigColumns,
72 BaseName: BaseName as typeof BaseName,
73 IsAlias: IsAlias as typeof IsAlias,
74 ExtraConfigBuilder: ExtraConfigBuilder as typeof ExtraConfigBuilder,
75 };
76
77 /**
78 * @internal
79 * Can be changed if the table is aliased.
80 */
81 [TableName]: string;
82
83 /**
84 * @internal
85 * Used to store the original name of the table, before any aliasing.
86 */
87 [OriginalName]: string;
88
89 /** @internal */
90 [Schema]: string | undefined;
91
92 /** @internal */
93 [Columns]!: T['columns'];
94
95 /** @internal */
96 [ExtraConfigColumns]!: Record<string, unknown>;
97
98 /**
99 * @internal
100 * Used to store the table name before the transformation via the `tableCreator` functions.
101 */
102 [BaseName]: string;
103
104 /** @internal */
105 [IsAlias] = false;
106

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected