0.3.0 • Published 6 years ago
ra-data-postgrest v0.3.0
React Admin Postgrest Data Provider
React Admin is a wonderful react framework and Postgrest is probably one of the fastest ways to create a robust backend with PostgreSQL database.
This is a data provider for supporting Postgrest backend with React Admin.
Install with (axios is a peer dependency):
npm i ra-data-postgrest axiosUsage:
const createDataProvider = require('ra-data-postgrest')
// or import createDataProvider from 'ra-data-postgrest';
const dataProvider = createDataProvider({
host: 'http://hostname',
port: 8080,
});
// Pass it to the <Admin />'s data provider
<Admin
title="Your App Name"
dataProvider={dataProvider}
>And that's it! You are good to go.
Supported Types
This data provider supports all types of react-admin calls:
| Types of actions |
|---|
| GET_LIST |
| GET_ONE |
| CREATE |
| UPDATE |
| UPDATE_MANY |
| DELETE |
| DELETE_MANY |
| GET_MANY |
| GET_MANY_REFERENCE |
Filtering
Postgrest supports many types of filters. This data provider supports them by accepts a source string with @:
| Filter | Example | Resulting query URL |
|---|---|---|
| eq | <TextInput source="name@eq" /> | ?name=eq.${filterValue} |
| gt | <SelectInput source="age@gt" /> | ?age=gt.${filterValue} |
| like | <TextInput source="name@like" /> | ?name=like.*${filterValue}* |
| ilike | <TextInput source="name@ilike" /> | ?name=ilike.*${filterValue}* |
| in | <TextInput source="name@in" /> | ?name=in.(${filterValues.join(,)}) |