Ben-xD
Ben-xD
Explore posts from servers
DTDrizzle Team
Created by tc on 11/6/2023 in #help
drizzle-zod with custom types
5 replies
DTDrizzle Team
Created by tc on 11/6/2023 in #help
drizzle-zod with custom types
5 replies
DTDrizzle Team
Created by tc on 11/6/2023 in #help
drizzle-zod with custom types
I've got a highly related problem, if you don't mind 🙂 I'm using a custom type (e.g. citext), but drizzle-zod will return that field as unknown instead of string. Does anyone know why?
import { customType } from "drizzle-orm/pg-core";

export const citext = customType<{ data: string }>({
dataType() {
return "citext";
},
});
import { customType } from "drizzle-orm/pg-core";

export const citext = customType<{ data: string }>({
dataType() {
return "citext";
},
});
5 replies
DTDrizzle Team
Created by Ben-xD on 7/29/2024 in #help
How to convert filters (e.g. eq(), ne(), lte(), like()) into SQL string, for use in sql.raw()
ahh i know why that happens. Basically, the filter queryParams.startTime is sometimes undefined: it's number | undefined. I just need to use sql a bit better
5 replies
DTDrizzle Team
Created by Ben-xD on 7/29/2024 in #help
How to convert filters (e.g. eq(), ne(), lte(), like()) into SQL string, for use in sql.raw()
I tried sql too, but it errors with error: syntax error at or near ")"
const query = db.select().from(user).innerJoin(message, eq(user.id, message.userId))
.where(sql`
message.received_at = (
SELECT MIN(received_at)
FROM message
WHERE message.user_id = user.id
AND message.received_at >= ${queryParams.startTime}
AND message.received_at <= ${queryParams.endTime}
)
`).orderBy(desc(message.receivedAtS));
const query = db.select().from(user).innerJoin(message, eq(user.id, message.userId))
.where(sql`
message.received_at = (
SELECT MIN(received_at)
FROM message
WHERE message.user_id = user.id
AND message.received_at >= ${queryParams.startTime}
AND message.received_at <= ${queryParams.endTime}
)
`).orderBy(desc(message.receivedAtS));
5 replies
DTDrizzle Team
Created by Ben-xD on 7/29/2024 in #help
How to convert filters (e.g. eq(), ne(), lte(), like()) into SQL string, for use in sql.raw()
This gets me halfway there: https://orm.drizzle.team/docs/sql#convert-sql-to-string-and-params But the problem is the params I passed into the filters (e.g. eq(user.id, userId)) is not added to the string.
5 replies
TtRPC
Created by Ben-xD on 12/20/2023 in #❓-help
Why do people use SplitLink? (http + websocket)
Ahh, I guess you do lose caching
5 replies
TtRPC
Created by Ben-xD on 12/20/2023 in #❓-help
Why do people use SplitLink? (http + websocket)
Ahh, just found this interesting post: https://stackoverflow.com/a/29933428/7365866
5 replies
TtRPC
Created by Ben-xD on 12/20/2023 in #❓-help
Why do people use SplitLink? (http + websocket)
It's an interesting point on using resources - though that should definitely be measured (since you're saying use both HTTP + WS, not just WS, or just HTTP). Websocket messages are more efficient than http requests, which send the headers on every request, including possibly a large JWT. It can also require establishing a new connection and handshake with the server. I've seen benchmarks from websocket backends (centrifugo) that mention 500mb of memory for 10k websocket clients - we already need to pay this cost because we're using websockets. For an app that already uses websockets for subscriptions, I don't see the value of also using HTTP, I really value the consistency of using websockets for everything - it simplifies authentication as well. Note: my tRPC APIs still do support HTTP because I use trpc-panel, which uses HTTP (it also doesn't support subscriptions). I just currently use wsLink on the client/browser, not splitLink. I'm still genuinely curious if I'm missing something. Is that performance impact obvious that we don't need to measure? or have you already measured it? I really wonder why go for the split link
5 replies
CDCloudflare Developers
Created by Advany on 12/18/2023 in #workers-discussions
will there ever be a new version of the
I wonder that as well. On https://cloudflareapps.com/apps/category/all, it says
Cloudflare Apps is no longer accepting new submissions. We're building a new Apps experience, if you're interested sign up here.
4 replies
CDCloudflare Developers
Created by Ben-xD on 12/17/2023 in #pages-discussions
Does anyone know why file hashes are
Lovely, it's working now, thanks
7 replies
CDCloudflare Developers
Created by Ben-xD on 12/18/2023 in #pages-help
Different requests get different files
Solved by bypassing cache for entire cloudflare pages. See thread above ^
2 replies
CDCloudflare Developers
Created by Ben-xD on 12/17/2023 in #pages-discussions
Does anyone know why file hashes are
Oh wow, lovely, thanks. I'll give that a go. Great idea to check the response headers, didn't think of that 🥹
7 replies
CDCloudflare Developers
Created by mr nooli on 12/14/2023 in #pages-help
NextJS is slower on CF than on Vercel
If you're using workers, I guess you're not using pages or https://github.com/cloudflare/next-on-pages?
9 replies
CDCloudflare Developers
Created by mr nooli on 12/14/2023 in #pages-help
NextJS is slower on CF than on Vercel
Do you mean the DNS proxy, @mr nooli ? Also, are you running on Cloudflare Pages or workers?
9 replies
CDCloudflare Developers
Created by Ben-xD on 12/17/2023 in #pages-discussions
Why would `process.env.EXAMPLE` be
Nope I use tRPC running on Node (not on cloudflare workers). I only have a cloudflare pages frontend running on cloudflare pages I'll still take a look, thanks for the link
13 replies
CDCloudflare Developers
Created by Ben-xD on 12/17/2023 in #pages-discussions
Does anyone know why file hashes are
I noticed they were cycling back and forth through a limited selection, it wasn't just random Weirdly, this has stopped happening now 🤔. No changes from my side Might be related to deployment, where CF pages doesn't always serve the latest build
7 replies
CDCloudflare Developers
Created by Ben-xD on 12/17/2023 in #pages-discussions
Does anyone know why file hashes are
Oh weird, its happening way more frequently for firefox: It still happens on chrome, but much less frequently (left chrome, right firefox)
7 replies
CDCloudflare Developers
Created by Ben-xD on 12/17/2023 in #pages-discussions
Why would `process.env.EXAMPLE` be
Yea, that's fixed it :), thanks for your replies
13 replies