OMG slurp

This commit is contained in:
Daniel Flanagan 2022-10-07 23:29:34 -05:00
parent a3ad382437
commit 1ec2181c2c
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4

View file

@ -18,7 +18,7 @@ const pool = new Pool(config.postgres.url, 3, true);
export async function queryObject<T>(
sql: string,
...args: QueryArguments[]
args: QueryArguments[],
): Promise<QueryObjectResult<T> | null> {
let result = null;
try {
@ -42,7 +42,7 @@ export async function queryObject<T>(
export async function queryArray<T extends unknown>(
sql: string,
...args: QueryArguments[]
args: QueryArguments[],
): Promise<QueryArrayResult<T[]> | null> {
let result = null;
try {
@ -71,7 +71,7 @@ export async function listNotes() {
export async function getNote(id: string | { id: string }) {
const idVal = typeof id == "object" ? id.id : id;
console.debug("getNote id =", idVal);
console.debug("getNote id =", JSON.stringify(idVal));
return await queryObject<Note>(
"select * from note where id = $1",
[idVal],