Execute the query and return results. Implementation depends on the specific loader type.
ProtectedgetGet the current modifiers as QuerySelectionModifiersWithOrderByFragment
ProtectedgetGet the SQL fragment
Limit the number of results
Skip a number of results
Order by a field. Can be called multiple times to add multiple order bys.
Order by a SQL fragment expression. Provides type-safe, parameterized ORDER BY clauses
import { sql, raw } from '@expo/entity-database-adapter-knex';
// Safe parameterized ordering
.orderBySQL(sql`CASE WHEN priority = ${1} THEN 0 ELSE 1 END, created_at DESC`)
// Dynamic column ordering
const sortColumn = 'name';
.orderBySQL(sql`${raw(sortColumn)} DESC NULLS LAST`)
// Complex expressions
.orderBySQL(sql`array_length(tags, 1) DESC, score * ${multiplier} ASC`)
SQL query builder for EnforcingKnexEntityLoader. Provides a fluent API for building and executing SQL queries with enforced authorization.