Chev
Chev
Explore posts from servers
DTDrizzle Team
Created by Chev on 1/30/2025 in #help
Is there a way to get typed results from executing a function on Postgres?
I have a function, get_widgets that returns rows. The default signature for rows returned is Record<string, unknown>[] Is there a way to specify the row type without having to cast to unknown first?
interface Widget {
id: number
name: string
}

const widgets = (
await db.execute(
sql`select * from get_widgets()`
)
).rows // Record<string, unknown>[]
interface Widget {
id: number
name: string
}

const widgets = (
await db.execute(
sql`select * from get_widgets()`
)
).rows // Record<string, unknown>[]
Prefer not to have to do
const widgets: Widget[] = (
await db.execute(
sql`select * from get_widgets()`
)
).rows as unknown as Widget[]
const widgets: Widget[] = (
await db.execute(
sql`select * from get_widgets()`
)
).rows as unknown as Widget[]
1 replies
TtRPC
Created by Chev on 8/27/2024 in #❓-help
subscriptions net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK) with httpSubscriptionLink on Bun/Hono
When using the Hono (Bun) middleware as per the instructions and setting up a tRPC subscription, the following error is thrown in the console, and a loop is created that eventually leads to a memory leak at the server:
net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
I don't see this with the equivalent Node http server. Is anyone else using tRPC subscriptions successfully with Hono? Repo here to reproduce: https://github.com/samuelgoldenbaum/honojs-middleware-issues-717
1 replies
HHono
Created by Chev on 8/27/2024 in #help
tRPC subscriptions throw net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK) with httpSubscriptionLink
When using the Hono middleware as per the instructions, and setting up a tRPC subscription, the following error is thrown in console and a loop is created that eventually leads to a memory leak at the server:
net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
I don't see this with the equivalent Node http server. Is anyone else using tRPC subscriptions successfully with Hono? Repo here to reproduce: https://github.com/samuelgoldenbaum/honojs-middleware-issues-717
1 replies