diff --git a/web/docs/library/delete.mdx b/web/docs/library/delete.mdx index 0b2f5519ca0..aacddd7ec15 100644 --- a/web/docs/library/delete.mdx +++ b/web/docs/library/delete.mdx @@ -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 './examples/delete' +import { deleteRecordJs, + deleteFilterJs, + deleteMatchJs, + deleteEqJs, + deleteGtJs, + deleteLtJs, + deleteGteJs, + deleteLteJs, + deleteLikeJs, + deleteIlikeJs, + deleteIsJs, + deleteInJs, + deleteNotJs + } from './examples/delete' @@ -56,48 +69,227 @@ const options = { ---- - ## Filtering ### `filter()` + + + +
+ ### `match()` + + + +
+ ### `eq()` + + + +
+ ### `gt()` + + + +
+ ### `lt()` + + + +
+ ### `gte()` + + + +
+ ### `lte()` + + + +
+ ### `like()` + + + +
+ ### `ilike()` + + + +
+ ### `is()` + + + +
+ ### `in()` + + + +
+ ### `not()` + + + +
+ ## Responses #### 200 OK -Successful +Successful request \ No newline at end of file diff --git a/web/docs/library/examples/delete.js b/web/docs/library/examples/delete.js index c8502ec1847..a462656bd7b 100644 --- a/web/docs/library/examples/delete.js +++ b/web/docs/library/examples/delete.js @@ -7,7 +7,7 @@ import { createClient } from '@supabase/supabase-js' const supabase = createClient('https://world.supabase.co', '1a2b-3c4d-5e6f-7g8h') -const updateCountryName = async () => { +const deleteCity = async () => { try { let values = await supabase .from('cities') @@ -19,4 +19,220 @@ const updateCountryName = async () => { console.log('Error: ', error) } } -` \ No newline at end of file +` + +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) + } +} +`