How do I create a helper to be used on a select array of fields?
How do I cast the type of a eb.fn('...') ?
eb.fn('now', []).$castTo<Date>()
eb.fn('now', []).$castTo<Date>()
cant use kysely-codegen
npm install --save-dev kysely-codegen
, and I set database string in .env
file. Next step is: kysely-codegen
, but I get this error when I type it in the console:
```
kysely-codegen
kysely-codegen : The term 'kysely-codegen' is not recognized as the name of a cmdlet, function, script file, o ...npx kysely-codegen
workswithSchema is marked as deprecated in ExpressionBuilder?
Insert values from subquery
eb.lit
:
To prevent SQL injections, only boolean, number and null values are accepted. If you need string or other literals, use sql.lit instead.
To prevent SQL injections, only boolean, number and null values are accepted. If you need string or other literals, use sql.lit instead.
$if with sql.raw doesn't compile
const filterWhereQuery = sql.raw(
LOWER("${dimensionName}") LIKE '%${filter?.toLowerCase()}%');
...<SqlBool>
generic to your sql
template tag....ORDER BY in agg function.
json_agg(table ORDER BY column) as values
json_agg(table ORDER BY column) as values
Binary fields in mySQL
typeCast
config of mysql2
```ts
typeCast: function (field, next) {
if (field.type === 'TINY' && field.length === 1) {...jsonb_build_object and raw sql possibilities
``
sql<string>
jsonb_build_object(${sql.join([
sql.raw('hair_type',coalesce (dog.hair_type, dog_breed.hair_type)
),
sql.raw('ear_type',coalesce (dog.ear_type, dog_breed.ear_type)
),...ts_rank in select
as
method.
sql<number>`ts_rank(to_tsvector('english', users.email, websearch_to_tsquery('R2023-185'))`.as('rank'),
sql<number>`ts_rank(to_tsvector('english', users.email, websearch_to_tsquery('R2023-185'))`.as('rank'),
How to convert this raw query to kysely?
Converting a more complex query to Kysely
Error "isSelectQueryBuilder" while using doUpdateSet on conflict
doUpdateSet
expression during an on conflict statement for an insert.
From my experiments, if the select type of the column is different (not assignable to) the insert/update types than something breaks at the type level and gives me an error
Repro:
https://kyse.link/?p=s&i=Wt7lre2AUUH7EdAInOja...New type error in 0.26.3
what is this error, i started getting it randomly
Kysely doesn't work in jest/test environment
db.selectFrom(...
commands just times out. I tried to log things via:
```
log(event) {
console.log(event);...Is there a plan to add "NULLS NOT DISTINCT" (postgresql v15) option to unique constraints/indexes?
How to work with window function ROW_NUMBER correctly?
``
const query =
WITH ranked_licenses AS (...executeTakeFirst does not add limit(1). Why?
How do you formulate a custom type argument?