File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/core/edgedb/generator Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export async function generateQueryBuilder({
22
22
} ) ;
23
23
addJsExtensionDeepPathsOfEdgedbLibrary ( qbDir ) ;
24
24
changeCustomScalars ( qbDir ) ;
25
+ updateEdgeQLRenderingForOurCustomScalars ( qbDir ) ;
25
26
changeImplicitIDType ( qbDir ) ;
26
27
allowOrderingByEnums ( qbDir ) ;
27
28
mergeDefaultTypesWithModuleNames ( qbDir ) ;
@@ -66,6 +67,23 @@ function changeImplicitIDType(qbDir: Directory) {
66
67
) ;
67
68
}
68
69
70
+ function updateEdgeQLRenderingForOurCustomScalars ( qbDir : Directory ) {
71
+ const file = qbDir . addSourceFileAtPath ( 'toEdgeQL.ts' ) ;
72
+ file . insertImportDeclaration ( 1 , {
73
+ namedImports : [ 'DateTime' ] ,
74
+ moduleSpecifier : 'luxon' ,
75
+ leadingTrivia : '\n' ,
76
+ } ) ;
77
+ const condition = ' } else if (val instanceof Date) {\n' ;
78
+ const updated = file . getText ( ) . replace (
79
+ condition ,
80
+ ` } else if (val instanceof DateTime) {
81
+ stringRep = \`'\${val.toISO()}'\`;
82
+ ` + condition ,
83
+ ) ;
84
+ file . replaceWithText ( updated ) ;
85
+ }
86
+
69
87
function allowOrderingByEnums ( qbDir : Directory ) {
70
88
const file = qbDir . getSourceFileOrThrow ( 'select.ts' ) ;
71
89
file
You can’t perform that action at this time.
0 commit comments