Convert record from Function call (RPC) to JSON
"(b38ed355-c2b0-4998-aff9-8c8dc429ffe5,My_Test_Key,valid,aead-det,22,\"\\\\x7067736f6469756d\",\"2025-01-19 02:09:04.392092+00\",,\"\")"
"(b38ed355-c2b0-4998-aff9-8c8dc429ffe5,My_Test_Key,valid,aead-det,22,\"\\\\x7067736f6469756d\",\"2025-01-19 02:09:04.392092+00\",,\"\")"
Generating dynamic raw query help
SELECT my_function(arg1 => 'some_value', arg2 => 123);
SELECT my_function(arg1 => 'some_value', arg2 => 123);
could not determine data type of parameter $1
cast(val("foo_col"), "text")
...Performance impact of "$if" ?
$if
calls to see if it helps. The impact is much smaller now than it was when I wrote that doc.How can I join 2 tables where 1 side is a JSON property in a JSON column?
Pagination
[Bug] innerJoinLateral selectAll prepends schema
db
variable that's instantiated withSchema
pointed at my_schema
2. selectFrom my_table
with an innerJoinLateral
on my_computed_object
3. select jsonObjectFrom(eb.selectFrom('my_computed_object').selectAll('my_computed_object'))
...withSchema('public')
for the subqueryExecuting stored procedure in MS SQL
sql
under the hood.
If these things can be introspected, there is potential in generating these type-safe functions....Flatten type of single column select?
$asScalar()
utility method that's probably landing in v0.28.
https://github.com/kysely-org/kysely/blob/v0.28/src/query-builder/select-query-builder.ts#L1938-L1986...Typing enums
enums
. I create the role
table as an "enum" table (which I got from another help post I was reading earlier) and add it as an foreign key to the teacher
table.
```ts...Any update on all migrations in single-transaction?
V0.28 Type Issues
npm i https://pkg.pr.new/kysely-org/kysely@1278
Identically named columns in multiple tables - How to use innerJoin.selectAll()?
selectAll
on 1 table (selectAll('tables')
) and then select
the other table/s columns while aliasing columns that exist multiple "tables"....Type safe discriminated union query
$castTo
assertions I have added are hurting type safety.
If I remove .$castTo<unknown>()
in the task query I get this error in the event query Property 'description' is missing in type '{ event_name: string; }' but required in type '{ description: string; }'
, and similar in the note query....Improving TS compile speed with multiple conditional selects?
include
object that determines whether to include various optional fields. Some endpoints have grown to accept 5-10 optional fields.
Each of these optional fields results in an additional $if
branch in the Kysely query. And this seems to harm TS compile speed -- I'm now waiting 1-3min for each compilation.
What are the best ways to mitigate the compile speed downsides of using many $if
calls?...Type safety in checkExpression in addCheckConstraint
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...