Trouble with dynamically allocating table name via string
Dynamic expression builder using raw SQL for WHERE column LIKE string% OR
const condition = dirPaths.map((dir) =>
sql<boolean>`file_path LIKE ${dir + '%'}`)
.reduce((acc, condition) => sql<boolean>`${acc} OR ${condition}`);
const condition = dirPaths.map((dir) =>
sql<boolean>`file_path LIKE ${dir + '%'}`)
.reduce((acc, condition) => sql<boolean>`${acc} OR ${condition}`);
How to define multiple configs in a NX monorepo?
kysely init
it creates the kysely.config.ts in the root ./config. Should I use conditional app selection by env variables?Making Updateable<X> fields required
UpdateableActivity
it shows:
```ts...ilike with reference
WHERE groups.group_name ILIKE '%' || users.first_name || '%'
WHERE groups.group_name ILIKE '%' || users.first_name || '%'
sql`'%'`,
sql`'%'`,
eb.val("%")
. Any other ways to make this more ergonomic?...Issue with how timestamptz is returned depending on main or subquery
timestamptz
type column
When I grab the lesson as followed:
```ts...pg
just parses the JSON object without checking strings if they represent timestamps and it doesn't get any metadata related to the contents of the JSON. That'll be quite slow as a default, to check those strings.select expression helper
tuple() and refTuple() questions
DELETE FROM table WHERE (col1,col2,col3) IN (...insert values);
i found out from my code editor intellisense that tuple()
and refTuple()
exist, but to my surprise, i can only insert 2 values in a single tuple.
is there a way for me to achieve that in kysely? or do i stick to raw sql for that?
...Casting part of a return type
SELECT
statement on a numeric field, but pg will parse this to a string. I want to be able to tell this in my output.
- I can't use $.castTo
because this destroys the other values in my SELECT
clause....Execute RAW Sql Queries
kysely
? i could not find any such function in the docs or the guide book
for example, describe table_name
errors because kysely itself cannot compile it. i am using mysql2
as my driver....await sql`RAW QUERY HERE;`.execute(db);
await sql`RAW QUERY HERE;`.execute(db);
Selecting result of subtraction with summation
"inventory.initial_quantity"
, rather than wrapping it in eb.val
🤦♂️Migrator transaction (postgresql dialect)
BEGIN
before and COMMIT
at the end?
```...migrateToLatest()
all migrations are run in a single transaction. They either all succeed or none of them succeed.
Also when you run migrateTo
the same happens. The only case where you get individual transactions is when you run the migrations in multiple calls.
You can't use migrateTo
or migrateToLatest()
?...Kysely client usage and pooling question
Implementing D1 batching (getting typed queries as input and returning typed InferResult)
executeBatch
method and I want to infer the results for each of the individual queries. Is this possible?I’m well versed in SQL and priority #1 is performance. Can Kysely still make sense for me?
Creating helper functions
how to union two queries with json_build_object?
QueryA | QueryB
. this query fails the type checker but the generated query seems to work as intended. is there a type hint i can provide somehow?
https://kyse.link/2TBLF...first_name
in the first one an name
in the second one. If both have the same property name it works. https://kyse.link/Bc300
When you use different keys, the correct type of the JSON object would be { name: string | undefined, first_name: string | undefined }
but Kysely isn't able to infer it....bulk-insert with constant variable as one column
Making CTE's reusable