objection.js
objection.js copied to clipboard
A few Typescript and Knex issues
Here are some misc things that I think could be changed. I've never written an open source PR before, I think it's easier if an existing contributor changed it:
- Knex supports objects for joins and aggregates. It's especially useful for multi-column joins:
.join(
'foo',
{
'foo.col1': 'bar.col1',
'foo.col2': 'bar.col2',
},
)
Something like this ((table: TableRef<QB>, columns: Record<string, ColumnRef>): QB;
) could be added to JoinMethod
.
-
Knex's
limit
now supports an additional param "skipBinding" (https://github.com/knex/knex/issues/4805). Objection'sFirstOperation
callslimit
withoutskipBinding
, which triggers an error in some databases (Materialize). -
Objection's type exports
UniqueViolationError
, but this actually needs to be imported fromdb-errors
. -
Objection's Model type doesn't include "propertyNameToColumnName".
-
(not a real issue)
addOperation
andKnexOperation
aren't documented or exposed through types, but they're useful for new or custom Knex operations.
Thanks for building and maintaining this awesome library!
Same problems here for Objection errors. In Typescript We can't do that :
import { UniqueViolationError } from 'objection';