edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

expose codecs for custom datatypes

Open juliusmarminge opened this issue 1 year ago • 1 comments
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

juliusmarminge avatar May 06 '24 10:05 juliusmarminge

This would be useful for encrypting/decrypting data that is encrypted at rest

emrosenf avatar May 06 '24 12:05 emrosenf