General purpose type-safe TypeScript client for PostgREST. Supports select, insert, update, upsert, delete queries with composite joins, resource embedding, full JSON column data handling and typing.
No interface changes. The only change is supported fields for column in .order([{ column: 'column_name' }]). Instead of only accepting current table column names, it now accepts embedded fields with dot notation to drill down.
The problem with this approach was with order precedence when top level and root orders are used together. We had problems constructing a query with both of these options order=id,films(id) and order=films(id),id.
We considered 2 solutions - precedence based on method call order, and one more property for precedence like weight: number. Both of these options looked like unintuitive, so instead we ended up with dot notation on root query (implementation in this PR)
Note that documentation will be added later after this is released.
Support for top level ordering using dot notation. https://postgrest.org/en/v12/references/api/resource_embedding.html#top-level-ordering
No interface changes. The only change is supported fields for
column
in.order([{ column: 'column_name' }])
. Instead of only accepting current table column names, it now accepts embedded fields with dot notation to drill down.Example:
Alternative considerations
We considered different approaches to implement this and current implementation was more difficult to implement but better for developer experience.
One of the alternatives we considered: Using more properties for order method parameters to say it's a top level query (
top: true
). Example:The problem with this approach was with order precedence when top level and root orders are used together. We had problems constructing a query with both of these options
order=id,films(id)
andorder=films(id),id
. We considered 2 solutions - precedence based on method call order, and one more property for precedence likeweight: number
. Both of these options looked like unintuitive, so instead we ended up with dot notation on root query (implementation in this PR)Note that documentation will be added later after this is released.