Initial commit
This commit is contained in:
79
node_modules/drizzle-orm/table.js
generated
vendored
Normal file
79
node_modules/drizzle-orm/table.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
import { entityKind } from "./entity.js";
|
||||
import { TableName } from "./table.utils.js";
|
||||
const Schema = Symbol.for("drizzle:Schema");
|
||||
const Columns = Symbol.for("drizzle:Columns");
|
||||
const ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
||||
const OriginalName = Symbol.for("drizzle:OriginalName");
|
||||
const BaseName = Symbol.for("drizzle:BaseName");
|
||||
const IsAlias = Symbol.for("drizzle:IsAlias");
|
||||
const ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
||||
const IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
||||
class Table {
|
||||
static [entityKind] = "Table";
|
||||
/** @internal */
|
||||
static Symbol = {
|
||||
Name: TableName,
|
||||
Schema,
|
||||
OriginalName,
|
||||
Columns,
|
||||
ExtraConfigColumns,
|
||||
BaseName,
|
||||
IsAlias,
|
||||
ExtraConfigBuilder
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
* Can be changed if the table is aliased.
|
||||
*/
|
||||
[TableName];
|
||||
/**
|
||||
* @internal
|
||||
* Used to store the original name of the table, before any aliasing.
|
||||
*/
|
||||
[OriginalName];
|
||||
/** @internal */
|
||||
[Schema];
|
||||
/** @internal */
|
||||
[Columns];
|
||||
/** @internal */
|
||||
[ExtraConfigColumns];
|
||||
/**
|
||||
* @internal
|
||||
* Used to store the table name before the transformation via the `tableCreator` functions.
|
||||
*/
|
||||
[BaseName];
|
||||
/** @internal */
|
||||
[IsAlias] = false;
|
||||
/** @internal */
|
||||
[IsDrizzleTable] = true;
|
||||
/** @internal */
|
||||
[ExtraConfigBuilder] = void 0;
|
||||
constructor(name, schema, baseName) {
|
||||
this[TableName] = this[OriginalName] = name;
|
||||
this[Schema] = schema;
|
||||
this[BaseName] = baseName;
|
||||
}
|
||||
}
|
||||
function isTable(table) {
|
||||
return typeof table === "object" && table !== null && IsDrizzleTable in table;
|
||||
}
|
||||
function getTableName(table) {
|
||||
return table[TableName];
|
||||
}
|
||||
function getTableUniqueName(table) {
|
||||
return `${table[Schema] ?? "public"}.${table[TableName]}`;
|
||||
}
|
||||
export {
|
||||
BaseName,
|
||||
Columns,
|
||||
ExtraConfigBuilder,
|
||||
ExtraConfigColumns,
|
||||
IsAlias,
|
||||
OriginalName,
|
||||
Schema,
|
||||
Table,
|
||||
getTableName,
|
||||
getTableUniqueName,
|
||||
isTable
|
||||
};
|
||||
//# sourceMappingURL=table.js.map
|
||||
Reference in New Issue
Block a user