const Insert = yield* SqlResolver.ordered("InsertEntity", {
Request: InsertEntitySchema,
Result: Entity,
execute: (requests) =>
sql.withTransaction(Effect.gen(function* () {
yield* sql`
INSERT INTO entities
${sql.insert(requests)}
RETURNING entities.*
`;
// How to perform the other inserts here?
// `requests` is an array. Do I have to extract the entries manually?
}))
});
const Insert = yield* SqlResolver.ordered("InsertEntity", {
Request: InsertEntitySchema,
Result: Entity,
execute: (requests) =>
sql.withTransaction(Effect.gen(function* () {
yield* sql`
INSERT INTO entities
${sql.insert(requests)}
RETURNING entities.*
`;
// How to perform the other inserts here?
// `requests` is an array. Do I have to extract the entries manually?
}))
});