Files
few-line-engine/tests/base/case1-payload.js

31 lines
649 B
JavaScript

/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable no-undef */
import "module/squel";
import "plugin/db";
function createSQL(id) {
return squel.select().from("test").where("id = ?", id).toString();
}
async function main(input, headers) {
const sql = createSQL(input.id);
await db.execute("START TRANSACTION");
// log(await db.execute('insert into test (name) values ("Test")'));
const res = await db.execute(sql);
// log(res);
return {
response: {
test: 1,
array: [1, 2, [{ id: 1, name: "Test" }]],
},
statusCode: 201,
headers: { "x-test-header": "test-header-value" },
};
}