49 lines
1.0 KiB
JavaScript
49 lines
1.0 KiB
JavaScript
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
/* eslint-disable no-undef */
|
|
|
|
import "module/squel";
|
|
import "plugin/db";
|
|
import "plugin/axios";
|
|
import "plugin/session";
|
|
import "plugin/query";
|
|
|
|
function createSQL(id) {
|
|
return squel.select().from("test").where("id = ?", id).toString();
|
|
}
|
|
|
|
async function main(input, headers) {
|
|
const sql = createSQL(input.id);
|
|
|
|
await db.query("START TRANSACTION");
|
|
|
|
await query.run("d079b709-eba3-49be-9f84-08ac6a64a8a8", input);
|
|
|
|
// log(await db.query('insert into test (name) values ("Test")'));
|
|
|
|
log(new Date().toISOString());
|
|
// const a = await axios.get("https://httpbin.dev/delay/10", {
|
|
// timeout: 50000000,
|
|
// });
|
|
|
|
// log(a);
|
|
|
|
log(await session.get("test"));
|
|
|
|
await session.set("test", 1);
|
|
|
|
// const res = await db.query(`
|
|
// SELECT SLEEP(10000);
|
|
// `);
|
|
|
|
log(new Date().toISOString());
|
|
|
|
return {
|
|
response: {
|
|
test: 1,
|
|
array: [1, 2, [{ id: 1, name: "Test" }]],
|
|
},
|
|
statusCode: 201,
|
|
headers: { "x-test-header": "test-header-value" },
|
|
};
|
|
}
|