Asserting type of .countAll() (MySQL)
countAll()
and sum()
are string | number | bigint
.
I assume this is in-case the number returned is too large to be stored in a JS "number." In my case, it appears to be being returned as strings
. Is it possible to assert it as a number
so that I don't need to wrap every query in a parseInt(result as string, 10)
?...Coalesce return empty array
null
when an array column is empty?
I already tried
``ts
.select(coalesce("categories",sql
ARRAY[]::"CollectionCategory"[]`).as("categories"))...kysely-codegen for multiple databases
--out-file
, rename the exported interfaces, then manually update index.d.ts
, but I was wondering if there's a better solution?...Using MySQL functions in SELECT statement
selectRaw
for these
SELECT a, b, UPPER(c) FROM x;
...Extract OrderBy TS Keys
insert into with mix of static and table values
INSERT INTO some_table (a, b, c, d) SELECT o.a, o.b, 16, 'hello world' FROM other_table O WHERE somekey = 32;
INSERT INTO some_table (a, b, c, d) SELECT o.a, o.b, 16, 'hello world' FROM other_table O WHERE somekey = 32;
Migration error "TypeError: Cannot read properties of undefined (reading 'getExecutor')"
where clause with length
select * from data where length(prodcode) = 3
...show generated sql
Property does not exist on type
Correct type definitions for function receiving builder
Transform Postgres array into JS array
{one, two}
into JS arrays ['one', 'two']
. Right I know the Postgres array is turned into a string when executing queries.select(sql<string[]>`categories::text[]`.as('categories'))
.select(sql<string[]>`categories::text[]`.as('categories'))
Noob Question: SQL INSERT that combines static values with a SELECT statement
Is there a way to execute an ExpressionBuilder?
Argument of type 'string' is not assignable to parameter of type 'DynamicReferenceBuilder<never>'.
fn("round", [fn.min("ld.price_btc"), sql.lit(5)]).as("floor_price"),
fn("round", [fn.min("ld.price_btc"), sql.lit(5)]).as("floor_price"),
How do Date columns works?
modified_at: ColumnType<Date, string | undefined, never>
modified_at: ColumnType<Date, string | undefined, never>
converting result.insertedId to number
result.insertedId
from bigInt
to Int
using Number(result.insertedID)
?Advice on building plugin for working with parameters
Mysql Query execution never ends
createPool
from mysql2
and not mysql2/promise
....How to do join with raw sql snippets?
left join videos on videos.id = CAST(highlights_content.item AS INT) AND highlights_content.collection = 'videos'
I tried using the provided sql
helper but can't really figure out which parts I need to replace with raw SQL for this to be possible....