entity.ts — drizzle-orm Source File
Architecture documentation for entity.ts, a typescript file in the drizzle-orm codebase. 0 imports, 8 dependents.
Entity Profile
Dependency Diagram
graph LR bc6d807f_7198_da43_c1e6_911af80c80ee["entity.ts"] ab181952_5759_c0bf_aeab_f255a140fe2a["alias.ts"] ab181952_5759_c0bf_aeab_f255a140fe2a --> bc6d807f_7198_da43_c1e6_911af80c80ee f75147d3_9ada_e5d8_9b05_204b10aba05f["casing.ts"] f75147d3_9ada_e5d8_9b05_204b10aba05f --> bc6d807f_7198_da43_c1e6_911af80c80ee 7bd0ba6a_93b0_0df7_7f87_d1a726b246cb["column.ts"] 7bd0ba6a_93b0_0df7_7f87_d1a726b246cb --> bc6d807f_7198_da43_c1e6_911af80c80ee 2f47d090_425d_2e56_2395_4c4d912316f0["relations.ts"] 2f47d090_425d_2e56_2395_4c4d912316f0 --> bc6d807f_7198_da43_c1e6_911af80c80ee a54a11d6_4422_4e60_3d09_6c04afd8f1eb["selection-proxy.ts"] a54a11d6_4422_4e60_3d09_6c04afd8f1eb --> bc6d807f_7198_da43_c1e6_911af80c80ee 562ff959_f5c2_ad28_16c7_59f4a572a158["subquery.ts"] 562ff959_f5c2_ad28_16c7_59f4a572a158 --> bc6d807f_7198_da43_c1e6_911af80c80ee ddbb35ab_7e67_d2b6_96ec_1f37678fcb67["table.ts"] ddbb35ab_7e67_d2b6_96ec_1f37678fcb67 --> bc6d807f_7198_da43_c1e6_911af80c80ee 99737bc3_a631_a054_9291_f966c791930f["utils.ts"] 99737bc3_a631_a054_9291_f966c791930f --> bc6d807f_7198_da43_c1e6_911af80c80ee style bc6d807f_7198_da43_c1e6_911af80c80ee fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
export const entityKind = Symbol.for('drizzle:entityKind');
export const hasOwnEntityKind = Symbol.for('drizzle:hasOwnEntityKind');
export interface DrizzleEntity {
[entityKind]: string;
}
export type DrizzleEntityClass<T> =
& ((abstract new(...args: any[]) => T) | (new(...args: any[]) => T))
& DrizzleEntity;
export function is<T extends DrizzleEntityClass<any>>(value: any, type: T): value is InstanceType<T> {
if (!value || typeof value !== 'object') {
return false;
}
if (value instanceof type) { // eslint-disable-line no-instanceof/no-instanceof
return true;
}
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
throw new Error(
`Class "${
type.name ?? '<unknown>'
}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`,
);
}
let cls = Object.getPrototypeOf(value).constructor;
if (cls) {
// Traverse the prototype chain to find the entityKind
while (cls) {
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
return true;
}
cls = Object.getPrototypeOf(cls);
}
}
return false;
}
Domain
Subdomains
Functions
Imported By
Source
Frequently Asked Questions
What does entity.ts do?
entity.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in entity.ts?
entity.ts defines 1 function(s): is.
What files import entity.ts?
entity.ts is imported by 8 file(s): alias.ts, casing.ts, column.ts, relations.ts, selection-proxy.ts, subquery.ts, table.ts, utils.ts.
Where is entity.ts in the architecture?
entity.ts is located at drizzle-orm/src/entity.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: drizzle-orm/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free