James
James
Explore posts from servers
DTDrizzle Team
Created by James on 10/11/2024 in #help
$returningId returning extra rows
Using a workaround until this is fixed:
export function getInsertedIds([
{ affectedRows, insertId },
]: MySqlRawQueryResult) {
return Array.from(
{ length: affectedRows },
(_, i) => BigInt(insertId) + BigInt(i)
);
}
export function getInsertedIds([
{ affectedRows, insertId },
]: MySqlRawQueryResult) {
return Array.from(
{ length: affectedRows },
(_, i) => BigInt(insertId) + BigInt(i)
);
}
Usage:
await db.insert(table).values([row1, row2]).then(getInsertedIds)
await db.insert(table).values([row1, row2]).then(getInsertedIds)
3 replies
DTDrizzle Team
Created by James on 10/11/2024 in #help
$returningId returning extra rows
It happens when there is a secondary unique id on the table, in my case I have a publicId field:
char({
length: NANO_ID_LENGTH,
})
.notNull()
.unique()
.$defaultFn(generateNanoId)
char({
length: NANO_ID_LENGTH,
})
.notNull()
.unique()
.$defaultFn(generateNanoId)
3 replies
TTCTheo's Typesafe Cult
Created by Aguilar on 12/7/2023 in #questions
Excalidraw rounded arrows
Couldn’t you just add that in as an image?
8 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
You will probably be better off making something custom that resembles the page rather than just tossing in the page itself
18 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
You could try. workers-og takes in a string rather than JSX. You might have some trouble with it formatting correctly to fit the bounds of the image, as well as what it's compatible with (e.g styling and elements on the page that may not be supported by the render engine backing the library).
18 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
@bacon I ended up going a pretty backwards route since I had an existing worker that did the image generation using https://github.com/kvnang/workers-og. So the role of the pages function ended up just being injecting the meta tags which I figured out how to do using the source code of @cloudflare/pages-plugin-vercel-og
18 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
@bacon
18 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
And is it installed in your package.json?
18 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
18 replies
CDCloudflare Developers
Created by James on 11/4/2023 in #workers-help
SSR for injecting social meta tags
For anyone that finds this, I found https://developers.cloudflare.com/pages/platform/functions/plugins/vercel-og/ which will fit my use case!
18 replies