OMG slurp
This commit is contained in:
parent
a3ad382437
commit
1ec2181c2c
|
@ -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],
|
||||
|
|
Loading…
Reference in a new issue