ServerSimulator Class — drizzle-orm Architecture
Architecture documentation for the ServerSimulator class in singlestore-proxy.test.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 02c4908a_3c23_944b_3035_d4ab28bc0f69["ServerSimulator"] 9145a9bc_26e0_3033_d0e2_0ad7e0dcc906["singlestore-proxy.test.ts"] 02c4908a_3c23_944b_3035_d4ab28bc0f69 -->|defined in| 9145a9bc_26e0_3033_d0e2_0ad7e0dcc906 06bdca76_02b4_871b_7edc_19917c26ef09["constructor()"] 02c4908a_3c23_944b_3035_d4ab28bc0f69 -->|method| 06bdca76_02b4_871b_7edc_19917c26ef09 cee34a27_f17c_f427_2fed_60c0bc296bb5["query()"] 02c4908a_3c23_944b_3035_d4ab28bc0f69 -->|method| cee34a27_f17c_f427_2fed_60c0bc296bb5 a249f835_c17c_f8f5_2468_bb3fe7b24b6d["migrations()"] 02c4908a_3c23_944b_3035_d4ab28bc0f69 -->|method| a249f835_c17c_f8f5_2468_bb3fe7b24b6d
Relationship Graph
Source Code
integration-tests/tests/singlestore/singlestore-proxy.test.ts lines 12–70
class ServerSimulator {
constructor(private db: mysql2.Connection) {}
async query(sql: string, params: any[], method: 'all' | 'execute') {
if (method === 'all') {
try {
const result = await this.db.query({
sql,
values: params,
rowsAsArray: true,
typeCast: function(field: any, next: any) {
if (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {
return field.string();
}
return next();
},
});
return { data: result[0] as any };
} catch (e: any) {
return { error: e };
}
} else if (method === 'execute') {
try {
const result = await this.db.query({
sql,
values: params,
typeCast: function(field: any, next: any) {
if (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {
return field.string();
}
return next();
},
});
return { data: result as any };
} catch (e: any) {
return { error: e };
}
} else {
return { error: 'Unknown method value' };
}
}
async migrations(queries: string[]) {
await this.db.query('START TRANSACTION');
try {
for (const query of queries) {
await this.db.query(query);
}
await this.db.query('COMMIT');
} catch (e) {
await this.db.query('ROLLBACK');
throw e;
}
return {};
}
}
Domain
Source
Frequently Asked Questions
What is the ServerSimulator class?
ServerSimulator is a class in the drizzle-orm codebase, defined in integration-tests/tests/singlestore/singlestore-proxy.test.ts.
Where is ServerSimulator defined?
ServerSimulator is defined in integration-tests/tests/singlestore/singlestore-proxy.test.ts at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free