This commit is contained in:
awalias committed 2020-03-16 12:39:27 +08:00
commit 89ec5bba4b
31 files changed
+1925 -586

No files matched your search

+3 -3
View File
@@ -1346,9 +1346,9 @@
}
},
"acorn": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw=="
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA=="
},
"adjust-sourcemap-loader": {
"version": "2.0.0",
+3 -3
View File
@@ -1209,9 +1209,9 @@
}
},
"acorn": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw=="
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA=="
},
"adjust-sourcemap-loader": {
"version": "2.0.0",
+5 -5
View File
@@ -38,17 +38,17 @@
"babel-plugin-add-module-exports": "^1.0.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-minify": "^0.3.0",
"babel-preset-minify": "^0.5.1",
"chai": "^4.1.2",
"cross-env": "^5.2.1",
"jest-websocket-mock": "^2.0.1",
"mocha": "^6.1.3",
"nyc": "^14.1.1",
"rimraf": "^2.6.2"
"mocha": "^7.1.0",
"nyc": "^15.0.0",
"rimraf": "^3.0.2"
},
"dependencies": {
"@supabase/doctest-js": "^0.1.0",
"@supabase/postgrest-js": "^0.8.0",
"@supabase/postgrest-js": "^0.9.0",
"@supabase/realtime-js": "^0.1.6",
"superagent": "^5.2.1"
}
-11
View File
@@ -9,17 +9,6 @@ supabase
Finds all rows whose value on the stated columnName exactly matches the specified filterValue. Equivalent of `filter(columName, 'eq', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.eq('name', 'New Zealand')
```
</Collapsable>
#### `columnName: string`
Name of the database column.
-12
View File
@@ -9,18 +9,6 @@ supabase
This allows you to apply various filters on your query. Filters can also be chained together.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3-5}
supabase
.from('countries')
.filter('name', 'in', ['China', 'France'])
.filter('status', 'eq', 'ACTIVE')
```
</Collapsable>
#### `columnName: string`
Name of the database column.
-11
View File
@@ -8,17 +8,6 @@ supabase
```
Finds all rows whose value on the stated columnName is greater than the specified filterValue. Eqiuvalent of `filter(columnName, 'gt', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.gt('id', 20)
```
</Collapsable>
#### `columnName: string`
Name of database column.
-11
View File
@@ -8,17 +8,6 @@ supabase
```
Finds all rows whose value on the stated columnName is greater than or equal to the specified filterValue. Eqiuvalent of `filter(columnName, 'gte', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.gte('id', 20)
```
</Collapsable>
#### `columnName: string`
Name of database column.
-12
View File
@@ -9,18 +9,6 @@ supabase
A case-sensitive version of `like()`. Equivalent of `filter(columnName, 'ilike', stringPattern)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.ilike('name', '%united%')
```
</Collapsable>
#### `columnName: string`
Name of database column.
-11
View File
@@ -9,17 +9,6 @@ supabase
Finds all rows whose value on the stated columnName is found on the specified filterArray. Equivalent of `filter(columnName, 'in', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.in('name', ['China', 'France'])
```
</Collapsable>
#### `columnName: string`
Name of database column.
-12
View File
@@ -10,18 +10,6 @@ supabase
A check for exact equality (**null**, **true**, **false**), finds all rows whose value on the state columnName exactly match the specified filterValue.
Equivalent of `filter(columnName, 'is', filterValue)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.is('name', null)
```
</Collapsable>
#### `columnName: string`
Name of database column.
-12
View File
@@ -9,18 +9,6 @@ supabase
Finds all rows whose value in the stated columnName matches the supplied pattern. Equivalent of `filter(columnName, 'like', stringPattern)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.like('name', '%United%')
```
</Collapsable>
#### `columnName: string`
Name of database column.
-11
View File
@@ -8,17 +8,6 @@ supabase
```
Finds all rows whose value on the stated columnName is less than the specified filterValue. Eqiuvalent of `filter(columnName, 'lt', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.lt('id', 20)
```
</Collapsable>
#### `columnName: string`
Name of database column.
-11
View File
@@ -8,17 +8,6 @@ supabase
```
Finds all rows whose value on the stated columnName is less than or equal to the specified filterValue. Eqiuvalent of `filter(columnName, 'lte', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.lte('id', 20)
```
</Collapsable>
#### `columnName: string`
Name of database column.
+1 -13
View File
@@ -7,19 +7,7 @@ supabase
.match(filterObject)
```
Finds rows that exactly match the specified filterObject. Equivilent of `filter('columnName', 'eq', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.match({ 'continent': 'Asia' })
```
</Collapsable>
Finds rows that exactly match the specified filterObject. Equivalent of multiple `filter('columnName', 'eq', criteria)`.
#### `filterObject: object`
An object of `{ 'columnName': 'criteria' }`
-11
View File
@@ -9,17 +9,6 @@ supabase
Finds all rows whose value on the stated columnName does not match the specified filterValue. Equivalent of `filter(columnName, 'not', criteria)`.
<Collapsable title="Toggle Example">
<!-- prettier-ignore -->
```js {3}
supabase
.from('countries')
.not('name', 'China')
```
</Collapsable>
#### `columnName: string`
Name of database column.
+195 -3
View File
@@ -10,7 +10,20 @@ import CommonResponses from '../common/CommonResponses.mdx'
import CommonFilters from '../common/CommonFilters'
import FromFunction from '../common/FromFunction.mdx'
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
import { deleteRecordJs } from './getExamples'
import { deleteRecordJs,
deleteFilterJs,
deleteMatchJs,
deleteEqJs,
deleteGtJs,
deleteLtJs,
deleteGteJs,
deleteLteJs,
deleteLikeJs,
deleteIlikeJs,
deleteIsJs,
deleteInJs,
deleteNotJs
} from './examples/delete'
<DummyData />
@@ -56,48 +69,227 @@ const options = {
----
## Filtering
### `filter()`
<CustomCodeBlock
header="Shows how to use filter( ) with delete( )"
js={deleteFilterJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='filter'/>
### `match()`
<CustomCodeBlock
header="Shows how to use match( ) with delete( )"
js={deleteMatchJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='match'/>
### `eq()`
<CustomCodeBlock
header="Shows how to use eq( ) with delete( )"
js={deleteEqJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='eq'/>
### `gt()`
<CustomCodeBlock
header="Shows how to use gt( ) with delete( )"
js={deleteGtJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='gt'/>
### `lt()`
<CustomCodeBlock
header="Shows how to use lt( ) with delete( )"
js={deleteLtJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='lt'/>
### `gte()`
<CustomCodeBlock
header="Shows how to use gte( ) with delete( )"
js={deleteGteJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='gte'/>
### `lte()`
<CustomCodeBlock
header="Shows how to use lte( ) with delete( )"
js={deleteLteJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='lte'/>
### `like()`
<CustomCodeBlock
header="Shows how to use like( ) with delete( )"
js={deleteLikeJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='like'/>
### `ilike()`
<CustomCodeBlock
header="Shows how to use ilike( ) with delete( )"
js={deleteIlikeJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='ilike'/>
### `is()`
<CustomCodeBlock
header="Shows how to use is( ) with delete( )"
js={deleteIsJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='is'/>
### `in()`
<CustomCodeBlock
header="Shows how to use in( ) with delete( )"
js={deleteInJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='in'/>
### `not()`
<CustomCodeBlock
header="Shows how to use not( ) with delete( )"
js={deleteNotJs}
jsHighlight="{9}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
}`}
/>
<br/>
<CommonFilters filter='not'/>
## Responses
#### 200 OK
Successful
Successful request
<CommonResponses />
+238
View File
@@ -0,0 +1,238 @@
/**
* delete.mdx examples
*/
export const deleteRecordJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const deleteCity = async () => {
try {
let values = await supabase
.from('cities')
.match({ id: 666 })
.delete()
return values
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteFilterJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.filter({'name', 'eq', 'Paris'})
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteMatchJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.match({name: 'Beijing', country_id: 156})
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteEqJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.eq('name', 'San Francisco')
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteGtJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.gt('country_id', 250)
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteLtJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.lt('country_id', 250)
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteGteJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.gte('country_id', 250)
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteLteJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.lte('country_id', 250)
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteLikeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.like('name', '%la%')
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteIlikeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.ilike('name', '%la%')
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteIsJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.is('name', null)
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteInJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.in('name', ['Rio de Janeiro', 'San Francisco'])
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const deleteNotJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const deleteCIty = async () => {
try {
let cities = await supabase
.from('cities')
.not('name', 'Lagos')
.delete()
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
+351
View File
@@ -0,0 +1,351 @@
/**
* get.mdx examples
*/
export const getSimpleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getColumnsJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.select('name')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getForeignJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCountries = async () => {
try {
let countries = await supabase
.from('countries')
.select(\`
name,
cities (
name
)
\`)
return countries
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getForeignMultipleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://shop.supabase.co', 'public-key-bOYapLADERfE')
const getProducts = async () => {
try {
let products = await supabase
.from('products')
.select(\`
id,
supplier:supplier_id ( name ),
purchaser:purchaser_id ( name )
\`)
return products
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getOrderJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.order('id')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getRangeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.range(0,3)
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getSingleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.range(0)
.single()
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getFilterJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.filter({'name', 'eq', 'Paris'})
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getMatchJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.match({name: 'Beijing', country_id: 156})
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getEqJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.eq('name', 'San Francisco')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getGtJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.gt('country_id', 250)
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getLtJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.lt('country_id', 250)
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getGteJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.gte('country_id', 250)
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getLteJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.lte('country_id', 250)
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getLikeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.like('name', '%la%')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getIlikeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.ilike('name', '%la%')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getIsJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.is('name', null)
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getInJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.in('name', ['Rio de Janeiro', 'San Francisco'])
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getNotJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.not('name', 'Lagos')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
+238
View File
@@ -0,0 +1,238 @@
/**
* patch.mdx examples
*/
export const patchRecordJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const updateCityName = async () => {
try {
let updates = await supabase
.from('cities')
.update({ name: 'Middle Earth' })
.match({ name: 'Auckland' })
return updates
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchFilterJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.filter({'name', 'eq', 'Paris'})
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchMatchJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.match({name: 'Beijing', country_id: 156})
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchEqJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.eq('name', 'San Francisco')
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchGtJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.gt('country_id', 250)
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchLtJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.lt('country_id', 250)
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchGteJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.gte('country_id', 250)
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchLteJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.lte('country_id', 250)
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchLikeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.like('name', '%la%')
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchIlikeJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.ilike('name', '%la%')
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchIsJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.is('name', null)
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchInJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.in('name', ['Rio de Janeiro', 'San Francisco'])
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const patchNotJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const updateCityName = async () => {
try {
let cities = await supabase
.from('cities')
.not('name', 'Lagos')
.update({ name: 'Mordor' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
+42
View File
@@ -0,0 +1,42 @@
/**
* post.mdx examples
*/
export const postSingleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.insert([
{ name: 'The Shire', country_id: 554 }
])
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const postBulkJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const createCities = async () => {
try {
let cities = await supabase
.from('cities')
.insert([
{ name: 'The Shire', country_id: 554 },
{ name: 'Rohan', country_id: 555 },
])
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
+54
View File
@@ -0,0 +1,54 @@
/**
* stored-procedures.mdx examples
*/
export const storedSingleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const echoCity = async () => {
try{
let city = await supabase
.rpc('echo_city', { name: 'The Shire' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const storedBulkJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const echoCities = async () => {
try{
let cities = await supabase
.rpc('echo_city', [
{ name: 'The Shire' },
{ name: 'Mordor' }
])
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const storedReadingJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const echoCities = async () => {
try{
let cities = await supabase
.rpc('asian_pacific_countries')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
+128
View File
@@ -0,0 +1,128 @@
/**
* subscribe.mdx examples
*/
export const subscribeAllJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('*')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeTableJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeInsertsJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('INSERT', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeUpdatesJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('UPDATE', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeDeletesJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('DELETE', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeMultipleJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('INSERT', handleRecordInserted)
.on('DELETE', handleRecordDeleted)
.subscribe()
`
export const subscribeUnsubscribeJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
// Unsubscribe from changes
mySubscription.unsubscribe()
`
export const subscribeRemoveJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
// Disconnect mySubscription
supabase.removeSubscription(mySubscription)
`
+294 -1
View File
@@ -12,7 +12,26 @@ import Collapsable from '../../src/components/Collapsable'
import FromFunction from '../common/FromFunction.mdx'
import DummyData from '../common/DummyData.mdx'
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
import { getSimpleJs, getColumnsJs, getForeignJs, getForeignMultipleJs } from './getExamples'
import { getSimpleJs,
getColumnsJs,
getForeignJs,
getForeignMultipleJs,
getOrderJs,
getRangeJs,
getSingleJs,
getFilterJs,
getMatchJs,
getEqJs,
getGtJs,
getLtJs,
getGteJs,
getLteJs,
getLikeJs,
getIlikeJs,
getIsJs,
getInJs,
getNotJs
} from './examples/get'
<DummyData />
@@ -188,6 +207,27 @@ supabase
### `order()`
<CustomCodeBlock
header="Shows how to use order( ) with select( )"
js={getOrderJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "San Francisco", "country_id": 840 },
{ "name": "Lagos", "country_id": 556 },
{ "name": "Auckland", "country_id": 554 },
{ "name": "Paris", "country_id": 250 },
{ "name": "Beijing", "country_id": 156 },
{ "name": "Rio de Janeiro", "country_id": 76 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<!-- prettier-ignore -->
```js {3}
supabase
@@ -210,6 +250,25 @@ Specifies whether null values will be displayed first.
### `range()`
<CustomCodeBlock
header="Shows how to use range( ) with select( )"
js={getRangeJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Rio de Janeiro", "country_id": 76 },
{ "name": "Beijing", "country_id": 156 },
{ "name": "Paris", "country_id": 250 },
{ "name": "Auckland", "country_id": 554 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<!-- prettier-ignore -->
```js {3}
supabase
@@ -229,6 +288,22 @@ Index or position of the end of the specified range. If not stated, all remainin
### `single()`
<CustomCodeBlock
header="Shows how to use single( ) with select( )"
js={getSingleJs}
jsHighlight="{10}"
response={`{
"body": {
"name": "San Francisco", "country_id": 840
},
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<!-- prettier-ignore -->
```js {3}
supabase
@@ -244,39 +319,257 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.
## Filtering
### `filter()`
<CustomCodeBlock
header="Shows how to use filter( ) with select( )"
js={getFilterJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Paris", "country_id": 250 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='filter'/>
### `match()`
<CustomCodeBlock
header="Shows how to use match( ) with select( )"
js={getMatchJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Beijing", "country_id": 156 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='match'/>
### `eq()`
<CustomCodeBlock
header="Shows how to use eq( ) with select( )"
js={getEqJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "San Francisco", "country_id": 840 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='eq'/>
### `gt()`
<CustomCodeBlock
header="Shows how to use gt( ) with select( )"
js={getGtJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Auckland", "country_id": 554 },
{ "name": "Lagos", "country_id": 556 },
{ "name": "San Francisco", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='gt'/>
### `lt()`
<CustomCodeBlock
header="Shows how to use lt( ) with select( )"
js={getLtJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Rio de Janeiro", "country_id": 76 },
{ "name": "Beijing", "country_id": 156 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='lt'/>
### `gte()`
<CustomCodeBlock
header="Shows how to use gte( ) with select( )"
js={getGteJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Paris", "country_id": 250 },
{ "name": "Auckland", "country_id": 554 },
{ "name": "Lagos", "country_id": 556 },
{ "name": "San Francisco", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='gte'/>
### `lte()`
<CustomCodeBlock
header="Shows how to use lte( ) with select( )"
js={getLteJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Rio de Janeiro", "country_id": 76 },
{ "name": "Beijing", "country_id": 156 },
{ "name": "Paris", "country_id": 250 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='lte'/>
### `like()`
<CustomCodeBlock
header="Shows how to use like( ) with select( )"
js={getLikeJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Auckland", "country_id": 554 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='like'/>
### `ilike()`
<CustomCodeBlock
header="Shows how to use ilike( ) with select( )"
js={getIlikeJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Auckland", "country_id": 554 },
{ "name": "Lagos", "country_id": 556 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='ilike'/>
### `is()`
<CustomCodeBlock
header="Shows how to use is( ) with select( )"
js={getIsJs}
jsHighlight="{9}"
response={`{
"body": [
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='is'/>
### `in()`
<CustomCodeBlock
header="Shows how to use in( ) with select( )"
js={getInJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Rio de Janeiro", "country_id": 76 },
{ "name": "San Francisco", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='in'/>
### `not()`
<CustomCodeBlock
header="Shows how to use not( ) with select( )"
js={getNotJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Rio de Janeiro", "country_id": 76 },
{ "name": "Beijing", "country_id": 156 },
{ "name": "Paris", "country_id": 250 },
{ "name": "Auckland", "country_id": 554 },
{ "name": "Lagos", "country_id": 556 },
{ "name": "San Francisco", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='not'/>
## Responses
-353
View File
@@ -1,353 +0,0 @@
/**
* subscribe.mdx examples
*/
export const subscribeAllJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('*')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeTableJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeInsertsJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('INSERT', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeUpdatesJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('UPDATE', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeDeletesJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('DELETE', payload => {
console.log('Change received!', payload)
})
.subscribe()
`
export const subscribeMultipleJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('INSERT', handleRecordInserted)
.on('DELETE', handleRecordDeleted)
.subscribe()
`
export const subscribeUnsubscribeJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
// Unsubscribe from changes
mySubscription.unsubscribe()
`
export const subscribeRemoveJs = `
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
// Listen to changes
const mySubscription = supabase
.from('countries')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
// Disconnect mySubscription
supabase.removeSubscription(mySubscription)
`
/**
* get.mdx examples
*/
export const getSimpleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.select('*')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getColumnsJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.select('name')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getForeignJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', 'public-key-bOYapLADERfE')
const getCountries = async () => {
try {
let countries = await supabase
.from('countries')
.select(\`
name,
cities (
name
)
\`)
return countries
} catch (error) {
console.log('Error: ', error)
}
}
`
export const getForeignMultipleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://shop.supabase.co', 'public-key-bOYapLADERfE')
const getProducts = async () => {
try {
let products = await supabase
.from('products')
.select(\`
id,
supplier:supplier_id ( name ),
purchaser:purchaser_id ( name )
\`)
return products
} catch (error) {
console.log('Error: ', error)
}
}
`
/**
* post.mdx examples
*/
export const postSingleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const getCities = async () => {
try {
let cities = await supabase
.from('cities')
.insert([
{ name: 'The Shire', country_id: 554 }
])
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const postBulkJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const createCities = async () => {
try {
let cities = await supabase
.from('cities')
.insert([
{ name: 'The Shire', country_id: 554 },
{ name: 'Rohan', country_id: 555 },
])
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
/**
* patch.mdx examples
*/
export const patchRecordJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const updateCountryName = async () => {
try {
let updates = await supabase
.from('countries')
.update({ name: 'Middle Earth' })
.match({ name: 'New Zealand' })
return updates
} catch (error) {
console.log('Error: ', error)
}
}
`
/**
* delete.mdx examples
*/
export const deleteRecordJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const updateCountryName = async () => {
try {
let values = await supabase
.from('cities')
.match({ id: 666 })
.delete()
return values
} catch (error) {
console.log('Error: ', error)
}
}
`
/**
* stored-procedures.mdx examples
*/
export const storedSingleJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const echoCity = async () => {
try{
let city = await supabase
.rpc('echo_city', { name: 'The Shire' })
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const storedBulkJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const echoCities = async () => {
try{
let cities = await supabase
.rpc('echo_city', [
{ name: 'The Shire' },
{ name: 'Mordor' }
])
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
export const storedReadingJs = `
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h')
const echoCities = async () => {
try{
let cities = await supabase
.rpc('asian_pacific_countries')
return cities
} catch (error) {
console.log('Error: ', error)
}
}
`
+239 -6
View File
@@ -11,7 +11,20 @@ import CommonResponses from '../common/CommonResponses.mdx'
import CommonFilters from '../common/CommonFilters'
import FromFunction from '../common/FromFunction.mdx'
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
import { patchRecordJs } from './getExamples'
import { patchRecordJs,
patchFilterJs,
patchMatchJs,
patchEqJs,
patchGtJs,
patchLtJs,
patchGteJs,
patchLteJs,
patchLikeJs,
patchIlikeJs,
patchIsJs,
patchInJs,
patchNotJs
} from './examples/patch'
<DummyData />
@@ -22,10 +35,12 @@ import { patchRecordJs } from './getExamples'
js={patchRecordJs}
jsHighlight="{7-10}"
response={`{
"body": null,
"status": 204,
"statusCode": 204,
"statusText": "No Content"
"body": [
{ "name": "Middle Earth", "country_id": 554 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
@@ -57,44 +72,262 @@ const options = {
## Filtering
### `filter()`
<CustomCodeBlock
header="Shows how to use filter( ) with update( )"
js={patchFilterJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 250 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='filter'/>
### `match()`
<CustomCodeBlock
header="Shows how to use match( ) with update( )"
js={patchMatchJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 156 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='match'/>
### `eq()`
<CustomCodeBlock
header="Shows how to use eq( ) with update( )"
js={patchEqJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 840 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='eq'/>
### `gt()`
<CustomCodeBlock
header="Shows how to use gt( ) with update( )"
js={patchGtJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 554 },
{ "name": "Mordor", "country_id": 556 },
{ "name": "Mordor", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='gt'/>
### `lt()`
<CustomCodeBlock
header="Shows how to use lt( ) with update( )"
js={patchLtJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 76 },
{ "name": "Mordor", "country_id": 156 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='lt'/>
### `gte()`
<CustomCodeBlock
header="Shows how to use gte( ) with update( )"
js={patchGteJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 250 },
{ "name": "Mordor", "country_id": 554 },
{ "name": "Mordor", "country_id": 556 },
{ "name": "Mordor", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='gte'/>
### `lte()`
<CustomCodeBlock
header="Shows how to use lte( ) with update( )"
js={patchLteJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 76 },
{ "name": "Mordor", "country_id": 156 },
{ "name": "Mordor", "country_id": 250 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='lte'/>
### `like()`
<CustomCodeBlock
header="Shows how to use like( ) with update( )"
js={patchLikeJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 554 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='like'/>
### `ilike()`
<CustomCodeBlock
header="Shows how to use ilike( ) with update( )"
js={patchIlikeJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 554 },
{ "name": "Mordor", "country_id": 556 },
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='ilike'/>
### `is()`
<CustomCodeBlock
header="Shows how to use is( ) with update( )"
js={patchIsJs}
jsHighlight="{9}"
response={`{
"body": [
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='is'/>
### `in()`
<CustomCodeBlock
header="Shows how to use in( ) with update( )"
js={patchInJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 76 },
{ "name": "Mordor", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='in'/>
### `not()`
<CustomCodeBlock
header="Shows how to use not( ) with update( )"
js={patchNotJs}
jsHighlight="{9}"
response={`{
"body": [
{ "name": "Mordor", "country_id": 76 },
{ "name": "Mordor", "country_id": 156 },
{ "name": "Mordor", "country_id": 250 },
{ "name": "Mordor", "country_id": 554 },
{ "name": "Mordor", "country_id": 556 },
{ "name": "Mordor", "country_id": 840 }
],
"status": 200,
"statusCode": 200,
"statusText": "OK"
}`}
/>
<br/>
<CommonFilters filter='not'/>
## Responses
#### 200 OK
Successful
Successful request
<CommonResponses />
+1 -1
View File
@@ -10,7 +10,7 @@ import Collapsable from '../../src/components/Collapsable'
import CommonResponses from '../common/CommonResponses.mdx'
import FromFunction from '../common/FromFunction.mdx'
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
import { postSingleJs, postBulkJs } from './getExamples'
import { postSingleJs, postBulkJs } from './examples/post'
<DummyData />
+1 -1
View File
@@ -9,7 +9,7 @@ import CommonFilters from '../common/CommonFilters'
import CommonResponses from '../common/CommonResponses.mdx'
import DummyData from '../common/DummyData.mdx'
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
import { storedSingleJs, storedBulkJs, storedReadingJs } from './getExamples'
import { storedSingleJs, storedBulkJs, storedReadingJs } from './examples/stored'
You can call stored procedures as a "Remote Procedure Call".
+1 -1
View File
@@ -8,7 +8,7 @@ import DummyData from '../common/DummyData.mdx'
import FromFunction from '../common/FromFunction.mdx'
import Collapsable from '../../src/components/Collapsable'
import CustomCodeBlock from '../../src/components/CustomCodeBlock'
import { subscribeAllJs, subscribeTableJs, subscribeInsertsJs, subscribeUpdatesJs, subscribeDeletesJs, subscribeMultipleJs, subscribeUnsubscribeJs, subscribeRemoveJs } from './getExamples'
import { subscribeAllJs, subscribeTableJs, subscribeInsertsJs, subscribeUpdatesJs, subscribeDeletesJs, subscribeMultipleJs, subscribeUnsubscribeJs, subscribeRemoveJs } from './examples/subscribe'
Subscribe to realtime changes in your own database.
+34 -31
View File
@@ -90,15 +90,6 @@ module.exports = {
// }
],
},
// {
// title: "Social",
// items: [
// {
// label: "Blog",
// to: "blog"
// }
// ]
// }
],
// logo: {
// alt: "Flock",
@@ -121,26 +112,38 @@ module.exports = {
},
],
],
// customFields: {
// headerJs: `
// // FULLSTORY - Please remove after initial user testing.
// window['_fs_debug'] = false;
// window['_fs_host'] = 'fullstory.com';
// window['_fs_script'] = 'edge.fullstory.com/s/fs.js';
// window['_fs_org'] = 'R5A9Z';
// window['_fs_namespace'] = 'FS';
// (function(m,n,e,t,l,o,g,y){
// if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;}
// g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[];
// o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script;
// y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);
// g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)};
// g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)};
// g.log = function(a,b) { g("log", [a,b]) };
// g.consent=function(a){g("consent",!arguments.length||a)};
// g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};
// g.clearUserCookie=function(){};
// })(window,document,window['_fs_namespace'],'script','user');
// `,
// },
customFields: {
headerJs: `
<!--Start of Tawk.to Script-->
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/5e0f4c517e39ea1242a2e675/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
<!--End of Tawk.to Script-->
// FULLSTORY - Please remove after initial user testing.
// window['_fs_debug'] ~= false;
// window['_fs_host'] = 'fullstory.com';
// window['_fs_script'] = 'edge.fullstory.com/s/fs.js';
// window['_fs_org'] = 'R5A9Z';
// window['_fs_namespace'] = 'FS';
// (function(m,n,e,t,l,o,g,y){
// if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;}
// g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[];
// o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script;
// y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);
// g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)};
// g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)};
// g.log = function(a,b) { g("log", [a,b]) };
// g.consent=function(a){g("consent",!arguments.length||a)};
// g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};
// g.clearUserCookie=function(){};
// })(window,document,window['_fs_namespace'],'script','user');
`,
},
}
+96 -39
View File
@@ -1676,9 +1676,9 @@
}
},
"acorn": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw=="
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA=="
},
"acorn-walk": {
"version": "6.2.0",
@@ -4993,7 +4993,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -5011,11 +5012,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -5028,15 +5031,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -5139,7 +5145,8 @@
},
"inherits": {
"version": "2.0.4",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@@ -5149,6 +5156,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -5161,17 +5169,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -5188,6 +5199,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -5268,7 +5280,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -5278,6 +5291,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -5353,7 +5367,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -5383,6 +5398,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -5400,6 +5416,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -5438,11 +5455,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@@ -10139,9 +10158,9 @@
}
},
"recharts": {
"version": "2.0.0-beta.1",
"resolved": "https://registry.npmjs.org/recharts/-/recharts-2.0.0-beta.1.tgz",
"integrity": "sha512-awJH2DE6JRgp5ymzmH5dKh2Pu6prqZJCr3NRaYCcyub1fBa+fIG3ZlpLyl9hWizHPGEvfZLvcjIM+qgTsr9aSQ==",
"version": "2.0.0-beta.3",
"resolved": "https://registry.npmjs.org/recharts/-/recharts-2.0.0-beta.3.tgz",
"integrity": "sha512-NMdG5SRro2q/ovZu8fSwmJgPwSz1sBHlnI1MuR6l5urTeNfgapAcu+72GhXDv8MN48UXxL1Pk+IkWs03SQ/YGw==",
"requires": {
"classnames": "^2.2.5",
"core-js": "^3.4.2",
@@ -12547,7 +12566,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -12565,11 +12585,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -12582,15 +12604,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -12693,7 +12718,8 @@
},
"inherits": {
"version": "2.0.4",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@@ -12703,6 +12729,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -12715,17 +12742,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -12742,6 +12772,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -12822,7 +12853,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -12832,6 +12864,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -12907,7 +12940,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -12937,6 +12971,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -12954,6 +12989,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -12992,11 +13028,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@@ -13546,7 +13584,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -13564,11 +13603,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -13581,15 +13622,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -13692,7 +13736,8 @@
},
"inherits": {
"version": "2.0.4",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@@ -13702,6 +13747,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -13714,17 +13760,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -13741,6 +13790,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -13821,7 +13871,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -13831,6 +13882,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -13906,7 +13958,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -13936,6 +13989,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -13953,6 +14007,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -13991,11 +14046,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true
"bundled": true,
"optional": true
}
}
},
Executable → Regular
+1 -1
View File
@@ -17,7 +17,7 @@
"react-dom": "^16.8.4",
"react-inlinesvg": "^1.2.0",
"react-perfect-scrollbar": "^1.5.3",
"recharts": "^2.0.0-beta.1"
"recharts": "^2.0.0-beta.3"
},
"browserslist": {
"production": [