bombillazo
Explore posts from serversConvert record from Function call (RPC) to JSON
Hello, I am using raw SQL to run a function that returns a record, but it is returning it to the TS domain as a string like this:
instead of a JSON object with those values in key/value pairs.
How can Kysely parse this value and convert it to an object?
4 replies
Generating dynamic raw query help
Hello, we are trying to create a function utility to call RPCs, we want to dynamically generate the following SQL query:
We are trying the following
But the outputs have been things like:
SELECT my_function($1, $2)
SELECT my_function([object Object],[object Object])
Is there a Kysely helper function to generate the arg1 => 'some_value', arg2 => 123
section of my query, or how should I go about it? Thanks for any help!4 replies
Issues migrating dependencies from v1.x to v2.x
Hey, I'm facing some issues when upgrading from v1.146 to v2.
We have a backend monorepo that uses
import_map.json
files to manage dependencies per sub module in our monorepo. We don't have a package.json for Deno (only for our Next.js frontend which is still on node). We do have a deno.jsonc
at the root level of our project. After upgrading to Deno v2, we get these errors when we run or try to install:
this is part of our import_map.json file:
What is the proper way to step Deno dependencies for v2 in a monorepo, and should we keep using import maps?2 replies
Kysely client usage and pooling question
Hello,
We have a long running server that at the moment creates a single Kysely instance. It is setup to use pg pooling. We have a util function called getKysely which returns this instance and is used throught our backend , like on every request handler that calls the DB. So in theory multiple concurrent requests call this function to get the Kysely client and make queries.
We are noticing that even within the same API endpoint handler, executing queries with a fetched client seems to be running on different connections. We think this because we sometimes execute raw sql queries which change the role of the connection, but later on using the same client we execute a query to check the current role and it is not the one set up previously.
I am curious about how Kysely internally uses pooling, does it fetch a connection from the pool on every query? I know we are using a singleton, but how can I make sure that Kysely uses a single connection throughout the scope of a single request?
7 replies
Reset position of terminal cursor when calling io.writeAllSync()
Currently using io.writeAllSync, the next data is written where the last data left off, even with a new line the cursor is kept horizontally in the position that was left.
I tried the ansi library cursorBack function but it did not work, how can I control or reset the cursor?
2 replies
Is there any way to force a Deno dependency to use a specific version of std?
We're having an issue were a dependency we are importing from npm with the
npm:
identifier is trying to use a node lib that only exisits up to std v0.177.0, specifically the tty
lib. Our main std version is in 0.244.0 specified in our import_map.json file.
Is there any way to specify this 3rd party dep to use the std version it requires to work?2 replies
Kysely setup in monolith API
Hello, we have a basic http server with a basic router and a PostgreSQL database. We're wondering what is the proper setup to use the Kysely client in our routes to make calls to the database. Should there be a singleton client that is used across routes, or do we need to instantiate a kysely client on every request ?
10 replies