convert() — drizzle-orm Function Reference
Architecture documentation for the convert() function in sqlgenerator.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 37697f6d_58a7_5188_1ba4_613ed78834df["convert()"] 52e7a846_b7dc_243d_dce9_f82a27463a07["PgCreatePolicyConvertor"] 37697f6d_58a7_5188_1ba4_613ed78834df -->|defined in| 52e7a846_b7dc_243d_dce9_f82a27463a07 style 37697f6d_58a7_5188_1ba4_613ed78834df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/sqlgenerator.ts lines 213–229
override convert(statement: JsonCreatePolicyStatement): string | string[] {
const policy = statement.data;
const tableNameWithSchema = statement.schema
? `"${statement.schema}"."${statement.tableName}"`
: `"${statement.tableName}"`;
const usingPart = policy.using ? ` USING (${policy.using})` : '';
const withCheckPart = policy.withCheck ? ` WITH CHECK (${policy.withCheck})` : '';
const policyToPart = policy.to?.map((v) =>
['current_user', 'current_role', 'session_user', 'public'].includes(v) ? v : `"${v}"`
).join(', ');
return `CREATE POLICY "${policy.name}" ON ${tableNameWithSchema} AS ${policy.as?.toUpperCase()} FOR ${policy.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does convert() do?
convert() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is convert() defined?
convert() is defined in drizzle-kit/src/sqlgenerator.ts at line 213.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free