Dylel
Explore posts from serversV0.28 Type Issues
Hey i've been trying to use v0.28 branch, but whenever i install this branch from pnpm all the kysely types break, is there another way for me to use this branch. I tried locally cloning and building but seem to have the same type issues. Typescript just can't find kysely package at all.
36 replies
Kysely Geometry Parsing Plugin - Convert driver values to/from geojson
0
I've currently written a rough prototype for parsing geometry. Most orms/query builders allow you to provide a mapValueToDb & mapValueFromDb based on a column type. However, kyseley doesn't really seem to have that.
I found transformQueryResponse inside a plugin example, so I've written one of those, of which I had to loop over every value (nested too) that could be a buffer and then parse it to geometry. So I've used this to handle parsing from DB to client, however transforming it back to the DB without knowing the column type was going to be near impossible.
So to get the value back into the db driver format, i've used a raw query builder response template (aslo from docs) to make the value to a geometry using an sql function.
I've made a repo: repo: https://github.com/dylel/kysely-mssql-geometry
FYI, i'm using a locally installed kyseley from a PR to support SQL Server as thats the DB i'm using. you'll need to build this if you want to actually run anything
the udt.ts wasn't created by me, that came from node-mssql as converting from microsoft's udt format is quite complicated
Is there a better way I could have done this? seems rather chaotic way to convert values to/from the DB driver. I've got it working in this format
plugin is called: geometry-handler-plugin
4 replies