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>(
|
export async function queryObject<T>(
|
||||||
sql: string,
|
sql: string,
|
||||||
...args: QueryArguments[]
|
args: QueryArguments[],
|
||||||
): Promise<QueryObjectResult<T> | null> {
|
): Promise<QueryObjectResult<T> | null> {
|
||||||
let result = null;
|
let result = null;
|
||||||
try {
|
try {
|
||||||
|
@ -42,7 +42,7 @@ export async function queryObject<T>(
|
||||||
|
|
||||||
export async function queryArray<T extends unknown>(
|
export async function queryArray<T extends unknown>(
|
||||||
sql: string,
|
sql: string,
|
||||||
...args: QueryArguments[]
|
args: QueryArguments[],
|
||||||
): Promise<QueryArrayResult<T[]> | null> {
|
): Promise<QueryArrayResult<T[]> | null> {
|
||||||
let result = null;
|
let result = null;
|
||||||
try {
|
try {
|
||||||
|
@ -71,7 +71,7 @@ export async function listNotes() {
|
||||||
|
|
||||||
export async function getNote(id: string | { id: string }) {
|
export async function getNote(id: string | { id: string }) {
|
||||||
const idVal = typeof id == "object" ? id.id : id;
|
const idVal = typeof id == "object" ? id.id : id;
|
||||||
console.debug("getNote id =", idVal);
|
console.debug("getNote id =", JSON.stringify(idVal));
|
||||||
return await queryObject<Note>(
|
return await queryObject<Note>(
|
||||||
"select * from note where id = $1",
|
"select * from note where id = $1",
|
||||||
[idVal],
|
[idVal],
|
||||||
|
|
Loading…
Reference in a new issue