kysely-planetscale icon indicating copy to clipboard operation
kysely-planetscale copied to clipboard

Anyway to force certain js types for different mysql types ?

Open OultimoCoder opened this issue 2 years ago • 1 comments

I would like e.g. for decimal types to have the type returned from planetscale as a string to maintain precision. I'm not too sure how to do this. I saw in the Kysely docs you could do a conversion via cast but at that point it is too late no?

Any way to maintain precision? Or do I have to perform a cast when retrieving it?

OultimoCoder avatar Mar 28 '24 15:03 OultimoCoder

Hey! So it's possible to cast values returned from the database to JS types explicitly, via a custom cast function (https://github.com/depot/kysely-planetscale#custom-cast-function), but otherwise this adapter just returns the types directly from https://github.com/planetscale/database-js. You may want to open an issue over there if you're seeing return types that you don't expect.

jacobwgillespie avatar Apr 29 '24 03:04 jacobwgillespie