Entity
    Preparing search index...

    Class EnforcingSQLQueryBuilder<TFields, TIDField, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>

    SQL query builder for EnforcingKnexEntityLoader. Provides a fluent API for building and executing SQL queries with enforced authorization.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Order by a SQL fragment expression. Provides type-safe, parameterized ORDER BY clauses

      Parameters

      • fragment: SQLFragment<Pick<TFields, TSelectedFields>>

        The SQL fragment to order by. Must not include the ASC/DESC keyword, as ordering direction is determined by the order parameter.

      • order: OrderByOrdering = OrderByOrdering.ASCENDING

        The ordering direction (ascending or descending). Defaults to ascending.

      • nulls: NullsOrdering | undefined = undefined

      Returns this

      query.orderByFragment(
      sql`(data->>'createdAt')::timestamp`,
      OrderByOrdering.DESCENDING,
      );
      // Generates ORDER BY clause that orders by the createdAt field in the JSONB data column, cast to a timestamp, in descending order.
      // Note that the SQL fragment is parameterized, so it is safe from SQL injection.
      // The generated SQL would look like: ORDER BY (data->>'createdAt')::timestamp DESC