full join "using" list of columns
using
, what is the correct way ?
example:
```...Is kysely sanitizing sql injection when using raw sql ?
${myString}
where myString contains sql injection, will kysely sanitize it or is it something that I need to take care of ?...Support for D1 batching
Omit/filter out columns from query
select(['1','2','3','4','5','6','7','8','10']
select(['1','2','3','4','5','6','7','8','10']
How to create a typed array of columns for select?
jsonObjectFrom
helpers since they are valid Select optionsReturn `null` by default if no record found
null
instead of undefined
if no records match my query when using executeTakeFirst
. Is there a way to set this in the Kysely client?cmpr as eb call SqlBool return type
eb.cmpr
has been removed and I now need to use eb()
as a function. Is there an easy way to get back a boolean
instead of a SqlBool
?
Before I just needed to call it like eb.cmpr<boolean>
. Thanks!
(I mean, other than a plain type assertion)...eb(...).$castTo<boolean>()
Argument of type 'RawBuilder<unknown>' is not assignable to...
sql<string>`(SELECT activityId FROM activities WHERE MATCH(EL_EQ_PRODUCT_DESCRIPTION) AGAINST (${'+' + value} IN BOOLEAN MODE))`
sql<string>`(SELECT activityId FROM activities WHERE MATCH(EL_EQ_PRODUCT_DESCRIPTION) AGAINST (${'+' + value} IN BOOLEAN MODE))`
Generic function to stream a table
Schema
, T
etc. are really wide (in this case completely unbounded). There's no information for Kysely to work with. The types don't work unless you give it an actual bounded schema.
You should avoid generic functions like this when using Kysely. Super strict and generic just don't work well together....Type errors after 0.27.1 upgrade
"Correct" way to create a unique index with some raw SQL
username
column, but I want it to be unique on LOWER(username)
. I have the following, and it works, but I was wondering if there is an alternative way to do this without having it all as a raw query?
``
await sql
CREATE UNIQUE INDEX users_unique_username_idx ON users (LOWER(username));`.execute(
db,...TS2345: Argument of type "id" is not assignable to parameter of type ReferenceExpression<Database
Join + Nested Object
lodges
and lodge_conditions
. I just wanna make a query such that I'll get back something of the type
```typescript
Selectable<LodgesTable> & { conditions: Selectable<LodgeConditionsTable> }...conditions_id
and JSON object as columns and join with it on conditions_id
and select just the JSON object column....Arbitrary insert statement
sql.parameter
function, but I don't see anything like that in the docs.sql
tag.
sql`insert into foo (id) values (${id})`.execute(db)
sql`insert into foo (id) values (${id})`.execute(db)
How to handle versioning of database objects.
Sqlite JSON
stringify
and parse
JSON myself when using Kysely, but it looks like I can addColumn("myColumn", "json")
. However, when I try to insert values as JSON, I get TypeError: SQLite3 can only bind numbers, strings, bigints, buffers, and null
.
If I strigify
my JSON first, it adds to the database properly, but the Kysely gives me type errors. Should I have my Database
table column of type string
when I am passing type "json" to Kysely?...case() return boolean (castTo doesn't work?)
TINYINT convert to bool
CASE with subquery clause
{ name: string }
:
```ts
eb.case()
.when('re.type', '=', 'company')...