Custom Plugin to transform Alias.* to "Alias.Column1", "Alias.Column2", etc.
can kysely be extended with custom types within the database
newbie need help with json_build_object
JSON_BUILD_OBJECT('id', unit.id, 'name', unit.name) AS unit
JSON_BUILD_OBJECT('id', unit.id, 'name', unit.name) AS unit
unit
object because you're using left join. The types are correct. If you are sure there's a unit
for each sku
then use innerJoin
instead....Solved: Exporting query builder classes
building kysely makes the package size very large
bun build --minify --outfile
, i get kysely to be 340.40kB whilst drizzle is 55.35kB, meanwhile the functional code besides the database is identicalKysely setup in monolith API
Is it possible to get the total count while fetching rows in a single query?
Separating results of join into objects of each type
Snippet compilation
Creating an 'enum' type column
Error when destructuring QueryCreator in withRecursive
Is `sql.join` the best way to concatenate sql templates?
let q = sql.raw` noteFtsFv.rowid ` + sql.raw` in `
let q = sql.raw` noteFtsFv.rowid ` + sql.raw` in `
Multiple calls to values in insert statement?
.values
multiple times on a query object. I've fixed it by passing an array to a single values call instead, but this seems like a bug no? Either the types should reflect that values can no longer be called after it has been, or it should collect the values calls into one array?using pgvector with Kysely
ERROR: column "embedding" is of type vector but expression is of type character varying
Happy to provide code if necessary but there aren’t any differences from the tutorial ...// Replace `string` with the type you have in the table interface.
sql<string>`${sql.ref(column)} <=> ${toSql(value)}::vector(3)`
// Replace `string` with the type you have in the table interface.
sql<string>`${sql.ref(column)} <=> ${toSql(value)}::vector(3)`
Static/reusable custom window functions
array_agg
window function and would like to reuse the existing FunctionModule
in a reusable way, so to have orderby, over, and so on.
Is there a way to get the function module you get from fn.agg
outside of an expression builder and without creating a puppet kysely instance, so to create an array_agg
function and return what fn.agg
return but properly typed?
As an example:...How to loop an array and based on this create a dynamic CTE but preserve type ?
``ts
for (const [references, columns] of referencesArray) {
const newQb = qb.with(
cte_${references}`, (wb) => {
wb = wb.selectFrom(references).distinct().selectAll(references);
for (const column of columns) {...string
into a string literal.
- Even if your strings had string literal types, you couldn't loop over them...On Conflict do update set ALL to be inserted columns
excluded
for those?
Example here...How to use kysely in edge runtime (like NextJS 14 middleware)?
how to write not (array1 && array2)