ra-data-postgrest
ra-data-postgrest copied to clipboard
Allow columns filtering for getList and getManyReference
Add support for Postgrest's Vertical Filtering (Columns).
When certain columns are wide (such as those holding binary data), it is more efficient for the server to withhold them in a response. The client can specify which columns are required using the select parameter.
Example usage
const { data, total, isLoading, error } = useGetList(
'posts',
{
pagination: { page: 1, perPage: 10 },
sort: { field: 'published_at', order: 'DESC' }
meta: { columns: ['id', 'title'] }
}
);
But you should be able to leverage this feature to rename columns:
columns: ['id', 'somealias:title']
and to cast columns:
columns: ['id::text', 'title']
and even get bits from a json or jsonb column"
columns: ['id', 'json_data->>blood_type', 'json_data->phones']
This PR only enables column filtering for getList
and getManyReference
. Column filtering for getOne
and getMany
would be another PR...
was included in https://github.com/raphiniert-com/ra-data-postgrest/pull/74