edgedb-js
edgedb-js copied to clipboard
expose codecs for custom datatypes
trafficstars
Describe the proposed feature
Drizzle has a killer feature with customTypes that allows you to use arbitrary datatypes: https://orm.drizzle.team/docs/custom-types. Here's an example of a date column that transforms a mysql date type that's used as a Temporal.PlainDate in JS land:
const temporalDateColumn = customType<{
data: Temporal.PlainDate;
driverData: string;
}>({
dataType: () => "date",
fromDriver: (value) => Temporal.PlainDate.from(value),
toDriver: (value) => value.toString(),
});
It would be nice to expose a similar feature in edgedb-js. Brief discussion on Discord: https://discord.com/channels/841451783728529451/1236652945429233664/1236829507911024750
This would be useful for encrypting/decrypting data that is encrypted at rest