Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add new temp client lib spec files, update generator

Terry Sutton0f131da66e5e
diff --git a/apps/docs/generator/legacy.ts b/apps/docs/generator/legacy.ts
index cf8e78e5f18..416ee41e0ce 100644
--- a/apps/docs/generator/legacy.ts
+++ b/apps/docs/generator/legacy.ts
@@ -17,6 +17,7 @@ import { uniqBy } from 'lodash'
import * as fs from 'fs'
import * as yaml from 'js-yaml'
+const commonDocSpec = yaml.load(fs.readFileSync('../../spec/common-client-libs.yml', 'utf8'))
export default async function gen(inputFileName: string, outputDir: string) {
const docSpec = yaml.load(fs.readFileSync(inputFileName, 'utf8'))
const defRef = docSpec.info.definition ? fs.readFileSync(docSpec.info.definition, 'utf8') : '{}'
@@ -24,7 +25,7 @@ export default async function gen(inputFileName: string, outputDir: string) {
const definition = JSON.parse(defRef)
const id = docSpec.info.id
const allLanguages = docSpec.info.libraries
- const pages = Object.entries(docSpec.pages).map(([name, x]: [string, OpenRef.Page]) => ({
+ const pages = Object.entries(docSpec.functions).map(([name, x]: [string, OpenRef.Page]) => ({
...x,
pageName: name,
}))
@@ -38,7 +39,10 @@ export default async function gen(inputFileName: string, outputDir: string) {
// Generate Pages
pages.forEach(async (pageSpec: OpenRef.Page) => {
try {
- const slug = slugify(pageSpec.pageName)
+ // get the slug from common-client-libs.yml
+ //const slug = slugify(pageSpec.id)
+ console.log(pageSpec.id)
+ const slug = commonDocSpec.functions.find((fn) => fn.id === pageSpec.id).slug
const hasTsRef = pageSpec['$ref'] || null
const tsDefinition = hasTsRef && extractTsDocNode(hasTsRef, definition)
if (hasTsRef && !tsDefinition) throw new Error('Definition not found: ' + hasTsRef)
@@ -48,8 +52,8 @@ export default async function gen(inputFileName: string, outputDir: string) {
// Create page
const content = Page({
- slug: (docSpec.info.slugPrefix || '') + slug,
- id: slug,
+ slug: slug,
+ id: pageSpec.id,
specFileName: docSpec.info.specUrl || inputFileName,
title: pageSpec.title || pageSpec.pageName,
description,
@@ -58,7 +62,7 @@ export default async function gen(inputFileName: string, outputDir: string) {
examples: generateExamples(id, pageSpec['examples'] || [], allLanguages),
notes: pageSpec.notes,
})
-
+ //console.log({ slug })
// Write to disk
const dest = outputDir + `/${slug}.mdx`
await writeToDisk(dest, content)
diff --git a/apps/docs/generator/legacy/definitions.ts b/apps/docs/generator/legacy/definitions.ts
index 96f1f44dfe3..72d50ce8f29 100644
--- a/apps/docs/generator/legacy/definitions.ts
+++ b/apps/docs/generator/legacy/definitions.ts
@@ -28,6 +28,7 @@ export namespace OpenRef {
title?: string
description?: string
notes?: string
+ id: string
// $ref?: string // reference to a TSDoc node
}
}
diff --git a/apps/docs/package.json b/apps/docs/package.json
index e7a26b1fc47..1740ab5b95a 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -22,13 +22,13 @@
"gen:storage:api": "ts-node ./generator/index.ts gen --type api --input ../../spec/transforms/storage_v0_openapi_deparsed.json --output ./docs/reference/storage/generated/usage.mdx",
"gen:storage:config": "ts-node ./generator/index.ts gen --type config --input ../../spec/storage_v0_config.yaml --output ./docs/reference/storage/generated/config.mdx",
"gen:supabase-dart:v0": "npm-run-all gen:supabase-dart:v0:ref",
- "gen:supabase-dart:v0:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_dart_v0.yml --output ./docs/reference/dart/v0/generated",
+ "gen:supabase-dart:v0:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_dart_v0_temp_new_shape.yml --output ./docs/reference/dart/v0/generated",
"gen:supabase-dart:v1": "npm-run-all gen:supabase-dart:v1:ref",
- "gen:supabase-dart:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_dart_v1.yml --output ./docs/reference/dart/generated",
+ "gen:supabase-dart:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_dart_v1_temp_new_shape.yml --output ./docs/reference/dart/generated",
"gen:supabase-js:v1": "npm-run-all gen:supabase-js:v1:ref",
- "gen:supabase-js:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v1.yml --output ./docs/reference/javascript/v1/generated",
+ "gen:supabase-js:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v1_temp_new_shape.yml --output ./docs/reference/javascript/v1/generated",
"gen:supabase-js:v2": "npm-run-all gen:supabase-js:v2:ref",
- "gen:supabase-js:v2:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v2.yml --output ./docs/reference/javascript/generated",
+ "gen:supabase-js:v2:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v2_temp_new_shape.yml --output ./docs/reference/javascript/generated",
"gen:realtime": "npm-run-all gen:realtime:config",
"gen:realtime:config": "ts-node ./generator/index.ts gen --type config --input ../../spec/realtime_v0_config.yaml --output ./docs/reference/realtime/generated/config.mdx"
},
diff --git a/apps/docs/pages/_middleware.ts b/apps/docs/pages/_middleware.ts
index 0c97458c77d..c7bb67a3023 100644
--- a/apps/docs/pages/_middleware.ts
+++ b/apps/docs/pages/_middleware.ts
@@ -1,15 +1,15 @@
-// import { NextResponse } from 'next/server'
-// import type { NextRequest } from 'next/server'
+import { NextResponse } from 'next/server'
+import type { NextRequest } from 'next/server'
-// // This function can be marked `async` if using `await` inside
-// export function middleware(request: NextRequest) {
-// const headers = new Headers(request.headers)
-// console.log('middleware?')
-// console.log({ headers })
-// //return NextResponse.redirect(new URL('/about-2', request.url))
-// }
+// This function can be marked `async` if using `await` inside
+export function middleware(request: NextRequest) {
+ const headers = new Headers(request.headers)
+ console.log('middleware?')
+ console.log({ headers })
+ //return NextResponse.redirect(new URL('/about-2', request.url))
+}
// See "Matching Paths" below to learn more
-// export const config = {
-// matcher: '/about/:path*',
-// }
+export const config = {
+ matcher: '/about/:path*',
+}
diff --git a/spec/client-libs-common.yml b/spec/client-libs-common.yml
new file mode 100644
index 00000000000..bcbfd839848
--- /dev/null
+++ b/spec/client-libs-common.yml
@@ -0,0 +1,189 @@
+clisCommon: '001'
+commands:
+ - id: supabase-test
+ title: supabase test
+ product: 'general'
+
+ - id: supabase-login
+ title: supabase login
+ product: 'general'
+
+ - id: supabase-link
+ title: supabase link
+ product: 'general'
+
+ - id: supabase-init
+ title: supabase init
+ product: 'general'
+
+ - id: supabase-test-db
+ title: supabase test db
+ product: 'general'
+
+ - id: supabase-stop
+ title: supabase stop
+ product: 'general'
+
+ - id: supabase-status
+ title: supabase status
+ product: 'general'
+
+ - id: supabase-start
+ title: supabase start
+ product: 'general'
+
+ - id: supabase-gen
+ title: supabase gen
+ product: 'general'
+
+ - id: supabase-gen-types
+ title: supabase gen types
+ product: 'general'
+
+ - id: supabase-gen-types-typescript
+ title: supabase gen types typescript
+ product: 'general'
+
+ - id: supabase-secrets
+ title: supabase secrets
+ product: 'secrets'
+
+ - id: supabase-secrets-unset
+ title: supabase secrets unset
+ product: 'secrets'
+
+ - id: supabase-secrets-set
+ title: supabase secrets set
+ product: 'secrets'
+
+ - id: supabase-secrets-list
+ title: supabase secrets list
+ product: 'secrets'
+
+ - id: supabase-projects
+ title: supabase projects
+ product: 'projects'
+
+ - id: supabase-projects-list
+ title: supabase projects list
+ product: 'projects'
+
+ - id: supabase-projects-create
+ title: supabase projects create
+ product: 'projects'
+
+ - id: supabase-orgs
+ title: supabase orgs
+ product: 'organizations'
+
+ - id: supabase-orgs-list
+ title: supabase orgs list
+ product: 'organizations'
+
+ - id: supabase-migration
+ title: supabase migration
+ product: 'migration'
+
+ - id: supabase-migration-new
+ title: supabase migration new
+ product: 'migration'
+
+ - id: supabase-migration-list
+ title: supabase migration list
+ product: 'migration'
+
+ - id: supabase-functions
+ title: supabase functions
+ product: 'functions'
+
+ - id: supabase-functions-serve
+ title: supabase functions serve
+ product: 'functions'
+
+ - id: supabase-functions-new
+ title: supabase functions new
+ product: 'functions'
+
+ - id: supabase-functions-deploy
+ title: supabase functions deploy
+ product: 'functions'
+
+ - id: supabase-functions-delete
+ title: supabase functions delete
+ product: 'functions'
+
+ - id: supabase-domains
+ title: supabase domains
+ product: 'domains'
+
+ - id: supabase-domains-reverify
+ title: supabase domains reverify
+ product: 'domains'
+
+ - id: supabase-domains-get
+ title: supabase domains get
+ product: 'domains'
+
+ - id: supabase-domains-delete
+ title: supabase domains delete
+ product: 'domains'
+
+ - id: supabase-domains-create
+ title: supabase domains create
+ product: 'domains'
+
+ - id: supabase-domains-activate
+ title: supabase domains activate
+ product: 'domains'
+
+ - id: supabase-db
+ title: supabase db
+ product: 'database'
+
+ - id: supabase-db-reset
+ title: supabase db reset
+ product: 'database'
+
+ - id: supabase-db-remote
+ title: supabase db remote
+ product: 'database'
+
+ - id: supabase-db-remote-commit
+ title: supabase db remote commit
+ product: 'database'
+
+ - id: supabase-db-remote-changes
+ title: supabase db remote changes
+ product: 'database'
+
+ - id: supabase-db-push
+ title: supabase db push
+ product: 'database'
+
+ - id: supabase-db-lint
+ title: supabase db lint
+ product: 'database'
+
+ - id: supabase-db-diff
+ title: supabase db diff
+ product: 'database'
+
+ - id: supabase-completion
+ title: supabase completion
+ product: 'completion'
+
+ - id: supabase-completion-zsh
+ title: supabase completion zsh
+ product: 'completion'
+
+ - id: supabase-completion-powershell
+ title: supabase completion powershell
+ product: 'completion'
+
+ - id: supabase-completion-fish
+ title: supabase completion fish
+ product: 'completion'
+
+ - id: supabase-completion-bash
+ title: supabase completion bash
+ product: 'completion'
diff --git a/spec/common-cli.yml b/spec/common-cli.yml
index bcbfd839848..9a58e768fe5 100644
--- a/spec/common-cli.yml
+++ b/spec/common-cli.yml
@@ -1,189 +1,364 @@
-clisCommon: '001'
-commands:
- - id: supabase-test
- title: supabase test
- product: 'general'
+openref: 0.1
- - id: supabase-login
- title: supabase login
- product: 'general'
+info:
+ id: reference/common-library-file
+ itle: Supabase Client libs common
+ description: |
- - id: supabase-link
- title: supabase link
- product: 'general'
+ This file shares info common between the JS and Dart libraries.
- - id: supabase-init
- title: supabase init
- product: 'general'
+functions:
+ - id: initializing
+ title: initializing
- - id: supabase-test-db
- title: supabase test db
- product: 'general'
+ - id: sign-up
+ title: signUp()
+ product: 'Auth'
- - id: supabase-stop
- title: supabase stop
- product: 'general'
+ - id: sign-in-with-password
+ title: signInWithPassword()
+ product: 'Auth'
- - id: supabase-status
- title: supabase status
- product: 'general'
+ - id: sign-in-with-otp
+ title: signInWithOtp()
+ product: 'Auth'
- - id: supabase-start
- title: supabase start
- product: 'general'
+ - id: sign-in-with-oauth
+ title: signInWithOAuth()
+ product: 'Auth'
- - id: supabase-gen
- title: supabase gen
- product: 'general'
+ - id: sign-out
+ title: signOut()
+ product: 'Auth'
- - id: supabase-gen-types
- title: supabase gen types
- product: 'general'
+ - id: verify-otp
+ title: verifyOtp()
+ product: 'Auth'
- - id: supabase-gen-types-typescript
- title: supabase gen types typescript
- product: 'general'
+ - id: get-session
+ title: getSession()
+ product: 'Auth'
- - id: supabase-secrets
- title: supabase secrets
- product: 'secrets'
-
- - id: supabase-secrets-unset
- title: supabase secrets unset
- product: 'secrets'
-
- - id: supabase-secrets-set
- title: supabase secrets set
- product: 'secrets'
-
- - id: supabase-secrets-list
- title: supabase secrets list
- product: 'secrets'
-
- - id: supabase-projects
- title: supabase projects
- product: 'projects'
-
- - id: supabase-projects-list
- title: supabase projects list
- product: 'projects'
-
- - id: supabase-projects-create
- title: supabase projects create
- product: 'projects'
-
- - id: supabase-orgs
- title: supabase orgs
- product: 'organizations'
-
- - id: supabase-orgs-list
- title: supabase orgs list
- product: 'organizations'
-
- - id: supabase-migration
- title: supabase migration
- product: 'migration'
-
- - id: supabase-migration-new
- title: supabase migration new
- product: 'migration'
-
- - id: supabase-migration-list
- title: supabase migration list
- product: 'migration'
-
- - id: supabase-functions
- title: supabase functions
- product: 'functions'
-
- - id: supabase-functions-serve
- title: supabase functions serve
- product: 'functions'
-
- - id: supabase-functions-new
- title: supabase functions new
- product: 'functions'
-
- - id: supabase-functions-deploy
- title: supabase functions deploy
- product: 'functions'
-
- - id: supabase-functions-delete
- title: supabase functions delete
- product: 'functions'
-
- - id: supabase-domains
- title: supabase domains
- product: 'domains'
-
- - id: supabase-domains-reverify
- title: supabase domains reverify
- product: 'domains'
-
- - id: supabase-domains-get
- title: supabase domains get
- product: 'domains'
-
- - id: supabase-domains-delete
- title: supabase domains delete
- product: 'domains'
-
- - id: supabase-domains-create
- title: supabase domains create
- product: 'domains'
-
- - id: supabase-domains-activate
- title: supabase domains activate
- product: 'domains'
-
- - id: supabase-db
- title: supabase db
- product: 'database'
-
- - id: supabase-db-reset
- title: supabase db reset
- product: 'database'
-
- - id: supabase-db-remote
- title: supabase db remote
- product: 'database'
-
- - id: supabase-db-remote-commit
- title: supabase db remote commit
- product: 'database'
-
- - id: supabase-db-remote-changes
- title: supabase db remote changes
- product: 'database'
-
- - id: supabase-db-push
- title: supabase db push
- product: 'database'
-
- - id: supabase-db-lint
- title: supabase db lint
- product: 'database'
-
- - id: supabase-db-diff
- title: supabase db diff
- product: 'database'
-
- - id: supabase-completion
- title: supabase completion
- product: 'completion'
-
- - id: supabase-completion-zsh
- title: supabase completion zsh
- product: 'completion'
-
- - id: supabase-completion-powershell
- title: supabase completion powershell
- product: 'completion'
-
- - id: supabase-completion-fish
- title: supabase completion fish
- product: 'completion'
-
- - id: supabase-completion-bash
- title: supabase completion bash
- product: 'completion'
+ - id: get-user
+ title: getUser()
+ product: 'Auth'
+
+ - id: update-user
+ title: updateUser()
+ product: 'Auth'
+
+ - id: set-session
+ title: setSession()
+ product: 'Auth'
+
+ - id: refresh-session
+ title: refreshSession()
+ product: 'Auth'
+
+ - id: on-auth-state-change
+ title: onAuthStateChange()
+ product: 'Auth'
+
+ - id: admin-api
+ title: Overview
+ product: 'Auth-admin'
+
+ - id: get-user-by-id
+ title: getUserById()
+ product: 'Auth-admin'
+
+ - id: list-users
+ title: listUsers()
+ product: 'Auth-admin'
+
+ - id: create-user
+ title: createUser()
+ product: 'Auth-admin'
+
+ - id: delete-user
+ title: deleteUser()
+ product: 'Auth-admin'
+
+ - id: invite-user-by-email
+ title: inviteUserByEmail()
+ product: 'Auth-admin'
+
+ - id: auth-reset-password-for-email
+ title: resetPasswordForEmail()
+ product: 'Auth-admin'
+
+ - id: generate-link
+ title: generateLink()
+ product: 'Auth-admin'
+
+ - id: update-user-by-id
+ title: updateUserById()
+ product: 'Auth-admin'
+
+ - id: select
+ title: 'Fetch data: select()'
+ product: 'Database'
+
+ - id: insert
+ title: 'Create data: insert()'
+ product: 'Database'
+
+ - id: update
+ title: 'Modify data: update()'
+ product: 'Database'
+
+ - id: upsert
+ title: 'Upsert data: upsert()'
+ product: 'Database'
+
+ - id: delete
+ title: 'Delete data: delete()'
+ product: 'Database'
+
+ - id: rpc
+ title: 'Postgres functions: rpc()'
+ product: 'Database'
+
+ - id: eq
+ title: eq()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: neq
+ title: neq()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: gt
+ title: gt()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: gte
+ title: gte()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: lt
+ title: lt()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: lte
+ title: lte()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: like
+ title: like()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: ilike
+ title: ilike()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: is
+ title: is()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: in
+ title: in()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: contains
+ title: contains()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: contained-by
+ title: containedBy()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: range-gt
+ title: rangeGt()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: range-gte
+ title: rangeGte()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: range-lt
+ title: rangeLt()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: range-lte
+ title: rangeLte()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: range-adjacent
+ title: rangeAdjacent()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: overlaps
+ title: overlaps()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: text-search
+ title: textSearch()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: match
+ title: match()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: not
+ title: not()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: or
+ title: or()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: filter
+ title: filter()
+ product: 'Database'
+ parent: 'Filters'
+
+ - id: using-modifiers
+ title: Using Modifiers
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: db-modifiers-select
+ title: select()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: order
+ title: order()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: limit
+ title: limit()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: range
+ title: range()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: abort-signal
+ title: abortSignal()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: single
+ title: single()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: maybeSingle
+ title: maybeSingle()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: csv
+ title: csv()
+ product: 'Database'
+ parent: 'Modifiers'
+
+ - id: invoke
+ title: invoke()
+ product: 'Functions'
+
+ - id: subscribe
+ title: on().subscribe()
+ product: 'Realtime'
+
+ - id: get-channels
+ title: getChannels()
+ product: 'Realtime'
+
+ - id: remove-channel
+ title: removeChannel()
+ product: 'Realtime'
+
+ - id: remove-all-channels
+ title: removeAllChannels()
+ product: 'Realtime'
+
+ - id: list-buckets
+ title: listBuckets()
+ product: 'Storage'
+
+ - id: get-bucket
+ title: getBucket()
+ product: 'Storage'
+
+ - id: create-bucket
+ title: createBucket()
+ product: 'Storage'
+
+ - id: empty-bucket
+ title: emptyBucket()
+ product: 'Storage'
+
+ - id: update-bucket
+ title: updateBucket()
+ product: 'Storage'
+
+ - id: delete-bucket
+ title: deleteBucket()
+ product: 'Storage'
+
+ - id: from-upload
+ title: from.upload()
+ product: 'Storage'
+
+ - id: from-update
+ title: from.update()
+ product: 'Storage'
+
+ - id: from-move
+ title: from.move()
+ product: 'Storage'
+
+ - id: from-copy
+ title: from.copy()
+ product: 'Storage'
+
+ - id: from-create-signed-url
+ title: from.createSignedUrl()
+ product: 'Storage'
+
+ - id: from-create-signed-urls
+ title: from.createSignedUrls()
+ product: 'Storage'
+
+ - id: from-get-public-url
+ title: from.getPublicUrl()
+ product: 'Storage'
+
+ - id: from-download
+ title: from.download()
+ product: 'Storage'
+
+ - id: from-remove
+ title: from.remove()
+ product: 'Storage'
+
+ - id: from-list
+ title: from.list()
+ product: 'Storage'
diff --git a/spec/common-client-libs.yml b/spec/common-client-libs.yml
index 10bdda935ba..460f4bb6659 100644
--- a/spec/common-client-libs.yml
+++ b/spec/common-client-libs.yml
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/common-library-file
- itle: Supabase Client libs common
+ title: Supabase Client libs common
description: |
This file shares info common between the JS and Dart libraries.
@@ -10,355 +10,441 @@ info:
functions:
- id: initializing
title: initializing
+ slug: initializing
- id: select
title: 'Fetching data'
+ slug: select
product: database
- id: insert
title: 'Insert data'
+ slug: insert
product: 'database'
- id: update
title: 'Update data'
+ slug: update
product: 'database'
- id: upsert
title: 'Upsert data'
+ slug: upsert
product: 'database'
- id: delete
title: 'Delete data'
+ slug: delete
product: 'database'
- id: rpc
title: 'Postgres functions'
+ slug: rpc
+ product: 'database'
+
+ - id: using-filters
+ title: 'Using filters'
+ slug: using-filters
product: 'database'
- id: eq
title: eq()
+ slug: eq
product: 'database'
parent: 'Filters'
- id: neq
title: neq()
+ slug: neq
product: 'database'
parent: 'Filters'
- id: gt
title: gt()
+ slug: gt
product: 'database'
parent: 'Filters'
- id: gte
title: gte()
+ slug: gte
product: 'database'
parent: 'Filters'
- id: lt
title: lt()
+ slug: lt
product: 'database'
parent: 'Filters'
- id: lte
title: lte()
+ slug: lte
product: 'database'
parent: 'Filters'
- id: like
title: like()
+ slug: like
product: 'database'
parent: 'Filters'
- id: ilike
title: ilike()
+ slug: ilike
product: 'database'
parent: 'Filters'
- id: is
title: is()
+ slug: is
product: 'database'
parent: 'Filters'
- id: in
title: in()
+ slug: in
product: 'database'
parent: 'Filters'
- id: contains
title: contains()
+ slug: contains
product: 'database'
parent: 'Filters'
- id: contained-by
title: containedBy()
+ slug: containedby
product: 'database'
parent: 'Filters'
- id: range-gt
title: rangeGt()
+ slug: rangegt
product: 'database'
parent: 'Filters'
- id: range-gte
title: rangeGte()
+ slug: rangegte
product: 'database'
parent: 'Filters'
- id: range-lt
title: rangeLt()
+ slug: rangelt
product: 'database'
parent: 'Filters'
- id: range-lte
title: rangeLte()
+ slug: rangelte
product: 'database'
parent: 'Filters'
- id: range-adjacent
title: rangeAdjacent()
+ slug: rangeadjacent
product: 'database'
parent: 'Filters'
- id: overlaps
title: overlaps()
+ slug: overlaps
product: 'database'
parent: 'Filters'
- id: text-search
title: textSearch()
+ slug: textsearch
product: 'database'
parent: 'Filters'
- id: match
title: match()
+ slug: match
product: 'database'
parent: 'Filters'
- id: not
title: not()
+ slug: not
product: 'database'
parent: 'Filters'
- id: or
title: or()
+ slug: or
product: 'database'
parent: 'Filters'
- id: filter
title: filter()
+ slug: filter
product: 'database'
parent: 'Filters'
- id: using-modifiers
title: Using Modifiers
+ slug: using-modifiers
product: 'database'
parent: 'Modifiers'
- id: db-modifiers-select
title: select()
+ slug: db-modifiers-select
product: 'database'
parent: 'Modifiers'
- id: order
title: order()
+ slug: order
product: 'database'
parent: 'Modifiers'
- id: limit
title: limit()
+ slug: limit
product: 'database'
parent: 'Modifiers'
- id: range
title: range()
+ slug: range
product: 'database'
parent: 'Modifiers'
- id: abort-signal
title: abortSignal()
+ slug: db-abortsignal
product: 'database'
parent: 'Modifiers'
- id: single
title: single()
+ slug: single
product: 'database'
parent: 'Modifiers'
- - id: maybeSingle
+ - id: maybe-single
title: maybeSingle()
+ slug: maybesingle
product: 'database'
parent: 'Modifiers'
- id: csv
title: csv()
+ slug: db-csv
product: 'database'
parent: 'Modifiers'
- id: sign-up
title: Sign up
+ slug: auth-signup
product: 'auth'
- id: sign-in-with-password
title: Sign in with password
+ slug: auth-signinwithpassword
product: 'auth'
- id: sign-in-with-otp
title: Sign in with OTP
+ slug: auth-signinwithotp
product: 'auth'
- id: sign-in-with-oauth
title: Sign in with 0auth
+ slug: auth-signinwithoauth
product: 'auth'
- id: sign-out
title: signOut()
+ slug: auth-signout
product: 'auth'
- id: verify-otp
title: verifyOtp()
+ slug: auth-verifyotp
product: 'auth'
- id: get-session
title: getSession()
+ slug: auth-getsession
product: 'auth'
- id: get-user
title: getUser()
+ slug: auth-getuser
product: 'auth'
- id: update-user
title: updateUser()
+ slug: auth-updateuser
product: 'auth'
- id: set-session
title: setSession()
+ slug: auth-setsession
product: 'auth'
- id: refresh-session
title: refreshSession()
+ slug: auth-refreshsession
product: 'auth'
- id: on-auth-state-change
title: onAuthStateChange()
+ slug: auth-onauthstatechange
product: 'auth'
- id: admin-api
title: Overview
+ slug: supabase-auth-admin-api
product: 'auth-admin'
- id: get-user-by-id
title: getUserById()
+ slug: auth-admin-getuserbyid
product: 'auth-admin'
- id: list-users
title: listUsers()
+ slug: auth-admin-listusers
product: 'auth-admin'
- id: create-user
title: createUser()
+ slug: auth-admin-createuser
product: 'auth-admin'
- id: delete-user
title: deleteUser()
+ slug: auth-admin-deleteuser
product: 'auth-admin'
- id: invite-user-by-email
title: inviteUserByEmail()
+ slug: auth-admin-inviteuserbyemail
product: 'auth-admin'
- id: auth-reset-password-for-email
title: resetPasswordForEmail()
+ slug: auth-admin-resetpasswordforemail
product: 'auth-admin'
- id: generate-link
title: generateLink()
+ slug: auth-admin-generatelink
product: 'auth-admin'
- id: update-user-by-id
title: updateUserById()
+ slug: auth-admin-updateuserbyid
product: 'auth-admin'
- id: invoke
title: invoke()
+ slug: auth-admin-invoke
product: 'functions'
- id: subscribe
title: on().subscribe()
+ slug: subscribe
product: 'realtime'
- id: get-channels
title: getChannels()
+ slug: getchannels
product: 'realtime'
- id: remove-channel
title: removeChannel()
+ slug: removechannel
product: 'realtime'
- id: remove-all-channels
title: removeAllChannels()
+ slug: removeallchannels
product: 'realtime'
- id: list-buckets
title: listBuckets()
+ slug: storage-listbuckets
product: 'storage'
- id: get-bucket
title: getBucket()
+ slug: storage-getbucket
product: 'storage'
- id: create-bucket
title: createBucket()
+ slug: storage-createbucket
product: 'storage'
- id: empty-bucket
title: emptyBucket()
+ slug: storage-emptybucket
product: 'storage'
- id: update-bucket
title: updateBucket()
+ slug: storage-updatebucket
product: 'storage'
- id: delete-bucket
title: deleteBucket()
+ slug: storage-deletebucket
product: 'storage'
- id: from-upload
title: from.upload()
+ slug: storage-from-upload
product: 'storage'
- id: from-update
title: from.update()
+ slug: storage-from-update
product: 'storage'
- id: from-move
title: from.move()
+ slug: storage-from-move
product: 'storage'
- id: from-copy
title: from.copy()
+ slug: storage-from-copy
product: 'storage'
- id: from-create-signed-url
title: from.createSignedUrl()
+ slug: storage-from-createsignedurl
product: 'storage'
- id: from-create-signed-urls
title: from.createSignedUrls()
+ slug: storage-from-createsignedurls
product: 'storage'
- id: from-get-public-url
title: from.getPublicUrl()
+ slug: storage-from-getpublicurl
product: 'storage'
- id: from-download
title: from.download()
+ slug: storage-from-download
product: 'storage'
- id: from-remove
title: from.remove()
+ slug: storage-from-remove
product: 'storage'
- id: from-list
title: from.list()
+ slug: storage-from-list
product: 'storage'
diff --git a/spec/supabase_dart_v0_temp_new_shape.yml b/spec/supabase_dart_v0_temp_new_shape.yml
index ebf2f78a08c..3acbf1d2bcf 100644
--- a/spec/supabase_dart_v0_temp_new_shape.yml
+++ b/spec/supabase_dart_v0_temp_new_shape.yml
@@ -16,12 +16,12 @@ info:
version: '0.0.1'
functions:
- - id: 'installing'
- name: 'Installing'
+ - id: installing
+ title: Installing
description: |
## Dart
- Dart libraries are built and supported by the community.
+ Dart libraries are built and supported by the community.
```bash
dart pub add supabase
@@ -29,7 +29,7 @@ functions:
Find the source code on [GitHub](https://github.com/supabase/supabase-dart).
- ## Flutter
+ ## Flutter
For Flutter project, you can use [supabase_flutter](https://github.com/supabase/supabase-flutter).
@@ -38,11 +38,12 @@ functions:
```
`supabase_flutter` plugin uses `supabase` plugin internally, and it adds some Flutter specific functionality such as handling deeplinks coming back from magic link verifications.
- If you are creating a Flutter application, we recommend using `supabase_flutter` instead of `supabase`.
+ If you are creating a Flutter application, we recommend using `supabase_flutter` instead of `supabase`.
For the most part `supabase_flutter` shares the same API as `supabase` with few exceptions such as initialization or OAuth sign in.
- - Initializing:
+ - id: initializing
+ title: Initializing
description: |
## Dart
You can initialize a new Supabase client using the `SupabaseClient()` method.
@@ -56,13 +57,15 @@ functions:
For `supabase_flutter`, you will be using the static `initialize()` method on `Supabase` class.
examples:
- - name: Dart SupabaseClient()
- dart: |
+ - id: dart-supabase-client
+ name: Dart SupabaseClient()
+ code: |
```dart
final supabase = SupabaseClient('https://xyzcompany.supabase.co', 'public-anon-key');
```
- - name: Flutter initialize()
- dart: |
+ - id: flutter-initialize
+ name: Flutter initialize()
+ code: |
```dart title="main.dart"
Future<void> main() async {
await Supabase.initialize(url: 'https://xyzcompany.supabase.co', anonKey: 'public-anon-key');
@@ -70,7 +73,8 @@ functions:
}
```
- - auth.signUp():
+ - id: sign-up
+ title: 'signUp()'
description: |
Creates a new user.
notes: |
@@ -79,78 +83,87 @@ functions:
- If "Email Confirmations" is turned off, both a `user` and a `session` will be returned
- When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
examples:
- - name: Sign up.
+ - id: sign-up
+ name: Sign up.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase.auth.signUp('[email protected]', 'example-password');
final user = res.data?.user;
final error = res.error;
```
- - name: Sign up with third-party providers.
+ - id: sign-up-with-third-party-providers
+ name: Sign up with third-party providers.
hideCodeBlock: true
description: |
If you are using Flutter, you can sign up with OAuth providers using the [`signInWithProvider()`](/docs/reference/dart/v0/auth-signinwithprovider) method available on `supabase_flutter`.
- - auth.signIn():
+ - id: sign-in
+ title: signIn()
description: |
Log in an existing user, or login via a third-party provider.
notes: |
- A user can sign up via email, phone number.
- If you provide `email` without a `password`, the user will be sent a magic link.
- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
- - Similarly, if you provide `phone` without a `password`, the user will be sent a one time password.
+ - Similarly, if you provide `phone` without a `password`, the user will be sent a one time password.
- If you are looking to sign users in with OAuth in Flutter apps, go to [`signInWithProvider()`](/docs/reference/dart/v0/auth-signinwithprovider).
examples:
- - name: Sign in with email.
+ - id: sign-in-with-email-and-password
+ name: Sign in with email.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase.auth.signIn(email: '[email protected]', password: 'example-password');
final user = res.data?.user;
final error = res.error;
```
- - name: Sign in with magic link.
+ - id: sign-in-with-magic-link
+ name: Sign in with magic link.
description: If email is provided, but no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
- dart: |
+ code: |
```dart
final res = await supabase.auth.signIn(email: '[email protected]');
final error = res.error;
```
- - name: Get OAuth sign in URL.
+ - title: get-oauth-sign-in-url
+ name: Get OAuth sign in URL.
description: |
- Passing provider parameter to `signIn()` will return a URL to sign your user in via OAuth.
+ Passing provider parameter to `signIn()` will return a URL to sign your user in via OAuth.
If you are looking to sign in a user via OAuth on Flutter app, go to [`signInWithProvider()`](/docs/reference/dart/v0/auth-signinwithprovider).
- dart: |
+ code: |
```dart
final res = await supabase.auth.signIn(provider: Provider.github);
final url = res.data?.url;
final error = res.error;
```
- - auth.signInWithProvider():
+ - id: sign-in-with-provider
+ title: signInWithProvider()
description: |
Signs the user in using third party OAuth providers.
notes: |
- `auth.signInWithProvider()` is only available on `supabase_flutter`
- It will open the browser to the relevant login page.
examples:
- - name: Sign in with provider.
+ - id: sign-in-with-provider
+ name: Sign in with provider.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase.auth.signInWithProvider(Provider.github);
final error = res.error;
```
- - name: With `redirectTo`
+ - id: sign-in-using-a-third-party-provider-with-redirect
+ name: With `redirectTo`
description: |
Specify the redirect link to bring back the user via deeplink.
Note that `redirectTo` should be null for Flutter Web.
- dart: |
+ code: |
```dart
final res = await supabase.auth.signInWithProvider(
Provider.github,
@@ -162,11 +175,12 @@ functions:
final error = res.error;
```
- - name: With scopes
+ - id: sign-in-with-scopes
+ name: With scopes
description: |
If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.
You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.
- dart: |
+ code: |
```dart
const { user, session, error } = await supabase.auth.signIn({
provider: 'github'
@@ -175,51 +189,58 @@ functions:
})
const oAuthToken = session.provider_token // use to access provider API
```
- - auth.signOut():
+ - id: sign-out
+ title: signOut()
description: |
Signs out the current user, if there is a logged in user.
examples:
- - name: Sign out
+ - id: sign-out
+ name: Sign out
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase.auth.signOut();
final error = res.error;
```
- - auth.session():
+ - id: get-session
+ title: getSession()
description: |
Returns the session data, if there is an active session.
examples:
- - name: Get the session data
+ - id: get-the-session-data
+ name: Get the session data
isSpotlight: true
- dart: |
+ code: |
```dart
final session = supabase.auth.session();
```
- - auth.user():
+ - id: get-user
+ title: currentUser
description: |
Returns the user data, if there is a logged in user.
examples:
- name: Get the logged in user
isSpotlight: true
- dart: |
+ code: |
```dart
final user = supabase.auth.user();
```
- - auth.update():
+ - id: update-user
+ title: updateUser()
description: |
Updates user data, if there is a logged in user.
notes: |
- It's generally better to store user data in a table inside your public schema (i.e. `public.users`).
+ It's generally better to store user data in a table inside your public schema (i.e. `public.users`).
Use the `update()` method if you have data which rarely changes or is specific only to the logged in user.
examples:
- - name: Update a user's metadata.
+ - id: update-the-users-metadata
+ name: Update a user's metadata.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase.auth.update(
UserAttributes(data: {'hello': 'world'})
@@ -228,13 +249,15 @@ functions:
final error = res.error;
```
- - auth.onAuthStateChange():
+ - id: on-auth-state-change
+ title: 'onAuthStateChange()'
description: |
Receive a notification every time an auth event happens.
examples:
- - name: Listen to auth changes
+ - id: listen-to-auth-changes
+ name: Listen to auth changes
isSpotlight: true
- dart: |
+ code: |
```dart
final subscription = supabase.auth.onAuthStateChange((event, session) {
print(session?.user?.id);
@@ -242,7 +265,8 @@ functions:
});
```
- - Reset Password (Email):
+ - id: auth-reset-password-for-email
+ title: Reset Password (Email)
description: |
Sends a reset request to an email address.
notes: |
@@ -263,18 +287,20 @@ functions:
);
```
examples:
- - name: Reset password
+ - id: reset-password
+ name: Reset password
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase.auth.api.resetPasswordForEmail('[email protected]');
final error = res.error;
```
- - name: Reset password for Flutter
+ - id: reset-password-for-flutter
+ name: Reset password for Flutter
isSpotlight: true
- dart: |
- You can pass `redirectTo` to open the app via deeplink when user opens the password reset email.
+ code: |
+ You can pass `redirectTo` to open the app via deeplink when user opens the password reset email.
```dart
final res = await supabase.auth.api.resetPasswordForEmail(
@@ -285,7 +311,7 @@ functions:
final error = res.error;
```
- - invoke():
+ - id: invoke
title: 'invoke()'
description: |
Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions.
@@ -293,19 +319,21 @@ functions:
- Requires an Authorization header.
- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.
examples:
- - name: Basic invocation.
+ - id: basic-invocation
+ name: Basic invocation.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabaseClient.functions.invoke('hello', body: {'foo': 'baa'});
final data = res.data;
final error = res.error;
```
- - name: Specifying response type.
+ - id: specifying-response-type
+ name: Specifying response type.
description: |
By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabaseClient.functions.invoke(
'hello',
@@ -315,11 +343,12 @@ functions:
final data = res.data;
final error = res.error;
```
- - name: Parsing custom headers.
+ - id: parsing-custom-headers
+ name: Parsing custom headers.
description: |
Any `headers` will be passed through to the function. A common pattern is to pass a logged-in user's JWT token as an Authorization header.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabaseClient.functions.invoke(
'hello',
@@ -329,7 +358,7 @@ functions:
},
);
```
- - select():
+ - id: select
description: |
Performs vertical filtering with SELECT.
title: 'Fetch data: select()'
@@ -339,9 +368,10 @@ functions:
- `select()` can be combined with [Filters](/docs/reference/dart/using-filters)
- If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465).
examples:
- - name: Getting your data
+ - id: getting-your-data
+ name: Getting your data
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -351,18 +381,20 @@ functions:
final data = res.data;
final error = res.error;
```
- - name: Selecting specific columns
+ - id: selecting-specific-columns
+ name: Selecting specific columns
description: You can select specific fields from your tables.
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
.select('name')
.execute();
```
- - name: Query foreign tables
+ - id: query-foreign-tables
+ name: Query foreign tables
description: If your database has relationships, you can query related tables too.
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -374,15 +406,16 @@ functions:
''')
.execute();
```
- - name: Query the same foreign table multiple times
+ - id: query-the-same-foreign-table-multiple-times
+ name: Query the same foreign table multiple times
description: |
- Sometimes you will need to query the same foreign table twice.
- In this case, you can use the name of the joined column to identify
- which join you intend to use. For convenience, you can also give an
- alias for each column. For example, if we had a shop of products,
- and we wanted to get the supplier and the purchaser at the same time
+ Sometimes you will need to query the same foreign table twice.
+ In this case, you can use the name of the joined column to identify
+ which join you intend to use. For convenience, you can also give an
+ alias for each column. For example, if we had a shop of products,
+ and we wanted to get the supplier and the purchaser at the same time
(both in the users) table:
- dart: |
+ code: |
```dart
final res = await supabase
.from('products')
@@ -393,11 +426,12 @@ functions:
''')
.execute();
```
- - name: Filtering with inner joins
+ - id: filtering-with-inner-joins
+ name: Filtering with inner joins
description: |
- If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted
+ If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted
to select all rows in a `message` table which belong to a user with the `username` "Jane":
- dart: |
+ code: |
```dart
final res = await supabase
.from('messages')
@@ -405,11 +439,12 @@ functions:
.eq('users.username', 'Jane')
.execute();
```
- - name: Querying with count option
+ - id: querying-with-count-option
+ name: Querying with count option
description: |
You can get the number of rows by using the count option.
Allowed values for count option are [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count).
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -418,14 +453,15 @@ functions:
final count = res.count;
```
- - name: Querying JSON data
+ - id: querying-json-data
+ name: Querying JSON data
description: |
- If you have data inside of a JSONB column, you can apply select
- and query filters to the data values. Postgres offers a
- [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
- for querying JSON data. Also see
+ If you have data inside of a JSONB column, you can apply select
+ and query filters to the data values. Postgres offers a
+ [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
+ for querying JSON data. Also see
[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details.
- dart: |
+ code: |
```dart
final res = await supabase
.from('users')
@@ -436,10 +472,11 @@ functions:
.eq('address->postcode', 90210)
.execute();
```
- - name: Return data as CSV
+ - id: return-data-as-csv
+ name: Return data as CSV
description: |
By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values.
- dart: |
+ code: |
```dart
final res = await supabase
.from('users')
@@ -448,18 +485,19 @@ functions:
.execute();
```
- - insert():
+ - id: insert
description: |
Performs an INSERT into the table.
title: 'Create data: insert()'
notes: |
- By default, every time you run `insert()`, the client library will make a `select` to return the full record.
- This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation.
+ This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation.
If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`.
examples:
- - name: Create a record
+ - id: create-a-record
+ name: Create a record
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -467,8 +505,9 @@ functions:
{'name': 'The Shire', 'country_id': 554}
]).execute();
```
- - name: Bulk create
- dart: |
+ - id: bulk-create
+ name: Bulk create
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -478,16 +517,17 @@ functions:
]).execute();
```
- - update():
+ - id: update
description: |
Performs an UPDATE on the table.
title: 'Modify data: update()'
notes: |
- `update()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to update.
examples:
- - name: Updating your data
+ - id: updating-your-data
+ name: Updating your data
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -495,18 +535,19 @@ functions:
.match({ 'name': 'Auckland' })
.execute();
```
- - name: Updating JSON data
+ - id: updating-json-data
+ name: Updating JSON data
description: |
- Postgres offers a
- [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
- for working with JSON data. Right now it is only possible to update an entire JSON document,
+ Postgres offers a
+ [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
+ for working with JSON data. Right now it is only possible to update an entire JSON document,
but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys.
- dart: |
+ code: |
```dart
final res = await supabase
.from('users')
.update({
- 'address': {
+ 'address': {
'street': 'Melrose Place',
'postcode': 90210
}
@@ -515,61 +556,65 @@ functions:
.execute();
```
- - upsert():
+ - id: upsert
description: |
Performs an UPSERT into the table.
title: 'Upsert data: upsert()'
notes: |
- - Primary keys should be included in the data payload in order for an update to work correctly.
+ - Primary keys should be included in the data payload in order for an update to work correctly.
- Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys.
examples:
- - name: Upsert your data
+ - id: upsert-your-data
+ name: Upsert your data
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('messages')
.upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' })
.execute();
```
- - name: Upserting into tables with constraints
+ - id: upserting-into-tables-with-constraints
+ name: Upserting into tables with constraints
description: |
- Running the following will cause supabase to upsert data into the `users` table.
- If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row
+ Running the following will cause supabase to upsert data into the `users` table.
+ If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row
based on the column passed into `onConflict`.
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('users')
.upsert({ 'username': 'supabot' }, { 'onConflict': 'username' })
.execute();
```
- - name: Return the exact number of rows
+ - id: return-the-exact-number-of-rows
+ name: Return the exact number of rows
description: |
Allowed values for count option are `exact`, `planned` and `estimated`.
- dart: |
+ code: |
```dart
final res = await supabase
.from('users')
- .upsert({
+ .upsert({
'id': 3,
- 'message': 'foo',
- 'username': 'supabot'
+ 'message': 'foo',
+ 'username': 'supabot'
})
.execute(count: CountOption.exact);
```
- - delete():
+ - id: delete
+ title: 'Delete data: delete()'
description: |
Performs a DELETE on the table.
- title: 'Delete data: delete()'
notes: |
- `delete()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to delete.
examples:
- - name: Delete records
+ - id: delete-records
+ name: Delete records
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -578,7 +623,7 @@ functions:
.execute();
```
- - rpc():
+ - id: rpc
title: 'Stored Procedures: rpc()'
description: |
You can call stored procedures as a "Remote Procedure Call".
@@ -586,34 +631,37 @@ functions:
That's a fancy way of saying that you can put some logic into your database then call it from anywhere.
It's especially useful when the logic rarely changes - like password resets and updates.
examples:
- - name: Call a stored procedure
+ - id: call-a-stored-procedure
+ name: Call a stored procedure
isSpotlight: true
description: This is an example invoking a stored procedure.
- dart: |
+ code: |
```dart
final res = await supabase
.rpc('hello_world')
.execute();
```
- - name: With Parameters
- dart: |
+ - id: with-parameters
+ name: With Parameters
+ code: |
```dart
final res = await supabase
.rpc('echo_city', params: { 'name': 'The Shire' })
.execute();
```
- - name: With count option
+ - id: with-count-option
+ name: With count option
description: |
You can specify a count option to get the row count along with your data.
Allowed values for count option are `exact`, `planned` and `estimated`.
- dart: |
+ code: |
```dart
final res = await supabase
.rpc('hello_world')
.execute(count: CountOption.exact);
```
- - subscribe():
+ - id: subscribe
description: |
Subscribe to realtime changes in your database.
title: 'on().subscribe()'
@@ -621,9 +669,10 @@ functions:
- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime).
- If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;`
examples:
- - name: Listen to all database changes
+ - id: listen-to-all-database-changes
+ name: Listen to all database changes
isSpotlight: true
- dart: |
+ code: |
```dart
final mySubscription = supabase
.from('countries')
@@ -632,8 +681,9 @@ functions:
})
.subscribe();
```
- - name: Listening to a specific table
- dart: |
+ - id: listening-to-a-specific-table
+ name: Listening to a specific table
+ code: |
```dart
final mySubscription = supabase
.from('countries')
@@ -642,8 +692,9 @@ functions:
})
.subscribe();
```
- - name: Listening to inserts
- dart: |
+ - id: listening-to-inserts
+ name: Listening to inserts
+ code: |
```dart
final mySubscription = supabase
.from('countries')
@@ -652,15 +703,16 @@ functions:
})
.subscribe();
```
- - name: Listening to updates
+ - id: listening-to-updates
+ name: Listening to updates
description: |
- By default, Supabase will send only the updated record. If you want to receive the previous values as well you can
- enable full replication for the table you are listening too:
+ By default, Supabase will send only the updated record. If you want to receive the previous values as well you can
+ enable full replication for the table you are listening too:
```sql
alter table "your_table" replica identity full;
```
- dart: |
+ code: |
```dart
final mySubscription = supabase
.from('countries')
@@ -669,15 +721,16 @@ functions:
})
.subscribe();
```
- - name: Listening to deletes
+ - id: listening-to-deletes
+ name: Listening to deletes
description: |
- By default, Supabase does not send deleted records. If you want to receive the deleted record you can
- enable full replication for the table you are listening too:
+ By default, Supabase does not send deleted records. If you want to receive the deleted record you can
+ enable full replication for the table you are listening too:
```sql
alter table "your_table" replica identity full;
```
- dart: |
+ code: |
```dart
final mySubscription = supabase
.from('countries')
@@ -686,9 +739,10 @@ functions:
})
.subscribe();
```
- - name: Listening to multiple events
+ - id: listening-to-multiple-events
+ name: Listening to multiple events
description: You can chain listeners if you want to listen to multiple events for each table.
- dart: |
+ code: |
```dart
final mySubscription = supabase
.from('countries')
@@ -696,9 +750,10 @@ functions:
.on(SupabaseEventTypes.delete, handleDelete)
.subscribe();
```
- - name: Listening to row level changes
+ - id: listening-to-row-level-changes
+ name: Listening to row level changes
description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.
- dart: |
+ code: |
```dart
final mySubscription = supabase
.from('countries:id=eq.200')
@@ -706,33 +761,35 @@ functions:
.subscribe();
```
- - removeSubscription():
+ - id: remove-subscription
description: |
Removes an active subscription and returns the number of open connections.
title: 'removeSubscription()'
notes: |
- Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed.
examples:
- - name: Remove a subscription
+ - id: remove-a-subscription
+ name: Remove a subscription
isSpotlight: true
- dart: |
+ code: |
```dart
supabase.removeSubscription(mySubscription);
```
- - getSubscriptions():
+ - id: get-subscriptions
description: |
Returns an array of all your subscriptions.
title: 'getSubscriptions()'
examples:
- - name: Get all subscriptions
+ - id: get-all-subscriptions
+ name: Get all subscriptions
isSpotlight: true
- dart: |
+ code: |
```dart
final subscriptions = supabase.getSubscriptions();
```
- - stream():
+ - id: stream
description: |
Notifies of data at the queried table.
title: 'stream()'
@@ -740,28 +797,31 @@ functions:
- `stream()` will emit the initial data as well as any further change on the database as `Stream` of `List<Map<String, dynamic>>` by combining Postgrest and Realtime.
- Takes a list of primary key columns as its argument.
examples:
- - name: Listening to a specific table
+ - id: listening-to-a-specific-table
+ name: Listening to a specific table
isSpotlight: true
- dart: |
+ code: |
```dart
supabase
.from('countries')
.stream(['id'])
.execute();
```
- - name: Listening to a specific rows within a table
+ - id: listening-to-a-specific-rows-within-a-table
+ name: Listening to a specific rows within a table
description: |
You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.
This syntax is the as how you can filter data in Realtime
- dart: |
+ code: |
```dart
supabase
.from('countries:id=eq.120')
.stream(['id'])
.execute();
```
- - name: With `order()`
- dart: |
+ - id: with-order
+ name: With `order()`
+ code: |
```dart
supabase
.from('countries')
@@ -769,8 +829,9 @@ functions:
.order('name', ascending: false)
.execute();
```
- - name: With `limit()`
- dart: |
+ - id: with-limit
+ name: With `limit()`
+ code: |
```dart
supabase
.from('countries')
@@ -780,80 +841,84 @@ functions:
.execute();
```
- - storage.listBuckets():
+ - id: list-buckets
description: |
Retrieves the details of all Storage buckets within an existing product.
title: 'listBuckets()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.listBuckets'
notes: |
- Policy permissions required:
- - `buckets` permissions: `select`
+ - `buckets` permissions: `select`
- `objects` permissions: none
examples:
- - name: List buckets
+ - id: list-buckets
+ name: List buckets
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.listBuckets()
```
- - storage.getBucket():
+ - id: get-bucket
description: |
Retrieves the details of an existing Storage bucket.
title: 'getBucket()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.getBucket'
notes: |
- Policy permissions required:
- - `buckets` permissions: `select`
+ - `buckets` permissions: `select`
- `objects` permissions: none
examples:
- - name: Get bucket
+ - id: get-bucket
+ name: Get bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.getBucket('avatars')
```
- - storage.createBucket():
+ - id: create-bucket
description: |
Creates a new Storage bucket
title: 'createBucket()'
notes: |
- Policy permissions required:
- - `buckets` permissions: `insert`
+ - `buckets` permissions: `insert`
- `objects` permissions: none
examples:
- - name: Create bucket
+ - id: create-bucket
+ name: Create bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.createBucket('avatars');
```
- - storage.emptyBucket():
+ - id: empty-bucket
description: |
Removes all objects inside a single bucket.
title: 'emptyBucket()'
notes: |
- Policy permissions required:
- - `buckets` permissions: `select`
+ - `buckets` permissions: `select`
- `objects` permissions: `select` and `delete`
examples:
- - name: Empty bucket
+ - id: empty-bucket
+ name: Empty bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.emptyBucket('avatars');
```
- - storage.updateBucket():
+ - id: update-bucket
description: |
Updates a new Storage bucket
title: 'updateBucket()'
@@ -862,16 +927,17 @@ functions:
- `buckets` permissions: `update`
- `objects` permissions: none
examples:
- - name: Update bucket
+ - id: update-bucket
+ name: Update bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.updateBucket('avatars', { public: false });
```
- - storage.deleteBucket():
+ - id: delete-bucket
description: |
Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket.
title: 'deleteBucket()'
@@ -880,28 +946,30 @@ functions:
- `buckets` permissions: `select` and `delete`
- `objects` permissions: none
examples:
- - name: Delete bucket
+ - id: delete-bucket
+ name: Delete bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.deleteBucket('avatars');
```
- - storage.from.upload():
+ - id: from-upload
description: |
Uploads a file to an existing bucket.
title: 'from.upload()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.upload'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `insert`
examples:
- - name: Upload file
+ - id: upload-file
+ name: Upload file
isSpotlight: true
- dart: |
+ code: |
```dart
final avatarFile = File('path/to/file');
final res = await supabase
@@ -913,18 +981,19 @@ functions:
));
```
- - storage.from.update():
+ - id: from-update
description: |
Replaces an existing file at the specified path with a new one.
title: 'from.update()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `update` and `select`
examples:
- - name: Update file
+ - id: update-file
+ name: Update file
isSpotlight: true
- dart: |
+ code: |
```dart
final avatarFile = File('path/to/file');
final res = await supabase
@@ -936,18 +1005,19 @@ functions:
));
```
- - storage.from.move():
+ - id: from-move
description: |
Moves an existing file, optionally renaming it at the same time.
title: 'from.move()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `update` and `select`
examples:
- - name: Move file
+ - id: move-file
+ name: Move file
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
@@ -955,18 +1025,19 @@ functions:
.move('public/avatar1.png', 'private/avatar2.png');
```
- - storage.from.createSignedUrl():
+ - id: from-create-signed-url
description: |
Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds.
title: 'from.createSignedUrl()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `select`
examples:
- - name: Create Signed URL
+ - id: create-signed-url
+ name: Create Signed URL
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
@@ -976,19 +1047,20 @@ functions:
final signedURL = res.data;
```
- - storage.from.getPublicUrl():
+ - id: from-get-public-url
description: |
Retrieve URLs for assets in public buckets
title: 'from.getPublicUrl()'
notes: |
- The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public"
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: none
examples:
- - name: Returns the URL for an asset in a public bucket
+ - id: returns-the-url-for-an-asset-in-a-public-bucket
+ name: Returns the URL for an asset in a public bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = supabase
.storage
@@ -998,18 +1070,19 @@ functions:
final publicURL = res.data;
```
- - storage.from.download():
+ - id: from-download
description: |
Downloads a file.
title: 'from.download()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `select`
examples:
- - name: Download file
+ - id: download-file
+ name: Download file
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
@@ -1017,18 +1090,19 @@ functions:
.download('avatar1.png');
```
- - storage.from.remove():
+ - id: from-remove
description: |
Deletes files within the same bucket
title: 'from.remove()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `delete` and `select`
examples:
- - name: Delete file
+ - id: delete-file
+ name: Delete file
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
@@ -1036,37 +1110,41 @@ functions:
.remove(['avatar1.png']);
```
- - storage.from.list():
+ - id: from-list
description: |
Lists all the files within a bucket.
title: 'from.list()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `select`
examples:
- - name: List files in a bucket
+ - id: list-files-in-a-bucket
+ name: List files in a bucket
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.storage
.from('avatars')
.list();
```
- - Using Modifiers:
+ - id: using-modifiers
+ title: Using Modifiers
description: |
- Modifiers can be used on `select()` queries.
+ Modifiers can be used on `select()` queries.
If a Stored Procedure returns a table response, you can also apply modifiers to the `rpc()` function.
- - limit():
+ - id: limit
+ title: limit()
description: |
Limits the result with the specified count.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1074,8 +1152,9 @@ functions:
.limit(1)
.execute();
```
- - name: With embedded resources
- dart: |
+ - id: with-embedded-resources
+ name: With embedded resources
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1085,13 +1164,15 @@ functions:
.execute();
```
- - order():
+ - id: order
+ title: order()
description: |
Orders the result with the specified column.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1099,8 +1180,9 @@ functions:
.order('id', ascending: false )
.execute();
```
- - name: With embedded resources
- dart: |
+ - id: with-embedded-resources
+ name: With embedded resources
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1110,13 +1192,15 @@ functions:
.execute();
```
- - range():
+ - id: range
+ title: range()
description: |
Limits the result to rows within the specified range, inclusive.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1125,13 +1209,15 @@ functions:
.execute();
```
- - single():
+ - id: single
+ title: single()
description: |
Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1140,9 +1226,10 @@ functions:
.execute();
```
- - Using Filters:
+ - id: using-filters
+ title: Using Filters
description: |
- Filters can be used on `select()`, `update()`, and `delete()` queries.
+ Filters can be used on `select()`, `update()`, and `delete()` queries.
If a Stored Procedure returns a table response, you can also apply filters.
@@ -1177,7 +1264,8 @@ functions:
.execute();
```
- - .or():
+ - id: or
+ title: or()
description: |
Finds all rows satisfying at least one of the filters.
notes: |
@@ -1189,9 +1277,10 @@ functions:
.or('id.in.(${mylist.join(',')}),rangecol.cs.(${mylistRange.join(',')}]') // You can insert a Dart list for list or range column.
```
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1199,9 +1288,10 @@ functions:
.or('id.eq.20,id.eq.30')
.execute();
```
- - name: Use `or` with `and`
+ - id: use-or-with-and
+ name: Use `or` with `and`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1212,7 +1302,7 @@ functions:
# TODO Not available at the moment, so would have to fix the bug on postgrest-dart first
# - name: Use `or` on foreign tables
# isSpotlight: true
- # dart: |
+ # code: |
# ```dart
# final res = await supabase
# .from('countries')
@@ -1220,7 +1310,8 @@ functions:
# .or('name.eq.Wellington,name.eq.Paris', { foreignTable: "cities" })
# ```
- - .not():
+ - id: not
+ title: not()
description: |
Finds all rows which doesn't satisfy the filter.
notes: |
@@ -1234,9 +1325,10 @@ functions:
.not('id','in','(${mylist.join(',')})') // You can insert a Dart list array.
```
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1244,8 +1336,9 @@ functions:
.not('name', 'eq', 'Paris')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1253,8 +1346,9 @@ functions:
.not('name', 'eq', 'Paris')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1262,8 +1356,9 @@ functions:
.not('name', 'eq', 'Paris')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1272,13 +1367,15 @@ functions:
.execute();
```
- - .match():
+ - id: match
+ title: match()
description: |
Finds all rows whose columns match the specified `query` object.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1286,8 +1383,9 @@ functions:
.match({'name': 'Beijing', 'country_id': 156})
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1295,8 +1393,9 @@ functions:
.match({'name': 'Beijing', 'country_id': 156})
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1304,8 +1403,9 @@ functions:
.match({'name': 'Beijing', 'country_id': 156})
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1314,13 +1414,15 @@ functions:
.execute();
```
- - .eq():
+ - id: eq
+ title: eq()
description: |
Finds all rows whose value on the stated `column` exactly matches the specified `value`.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1328,8 +1430,9 @@ functions:
.eq('name', 'The shire')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1337,8 +1440,9 @@ functions:
.eq('name', 'San Francisco')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1346,8 +1450,9 @@ functions:
.eq('name', 'Mordor')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1356,13 +1461,15 @@ functions:
.execute();
```
- - .neq():
+ - id: neq
+ title: neq()
description: |
Finds all rows whose value on the stated `column` doesn't match the specified `value`.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1370,8 +1477,9 @@ functions:
.neq('name', 'The shire')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1379,8 +1487,9 @@ functions:
.neq('name', 'San Francisco')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1388,8 +1497,9 @@ functions:
.neq('name', 'Mordor')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1398,13 +1508,15 @@ functions:
.execute();
```
- - .gt():
+ - id: gt
+ title: gt()
description: |
Finds all rows whose value on the stated `column` is greater than the specified `value`.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1412,8 +1524,9 @@ functions:
.gt('country_id', 250)
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1421,8 +1534,9 @@ functions:
.gt('country_id', 250)
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1430,8 +1544,9 @@ functions:
.gt('country_id', 250)
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1440,13 +1555,15 @@ functions:
.execute();
```
- - .gte():
+ - id: gte
+ title: gte()
description: |
Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1454,8 +1571,9 @@ functions:
.gte('country_id', 250)
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1463,8 +1581,9 @@ functions:
.gte('country_id', 250)
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1472,8 +1591,9 @@ functions:
.gte('country_id', 250)
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1482,13 +1602,15 @@ functions:
.execute();
```
- - .lt():
+ - id: lt
+ title: lt()
description: |
Finds all rows whose value on the stated `column` is less than the specified `value`.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1496,8 +1618,9 @@ functions:
.lt('country_id', 250)
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1505,8 +1628,9 @@ functions:
.lt('country_id', 250)
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1514,8 +1638,9 @@ functions:
.lt('country_id', 250)
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1524,14 +1649,16 @@ functions:
.execute();
```
- - .lte():
+ - id: lte
+ title: lte()
description: |
Finds all rows whose value on the stated `column` is less than or equal to the specified `value`.
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.lte'
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1539,8 +1666,9 @@ functions:
.lte('country_id', 250)
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1548,8 +1676,9 @@ functions:
.lte('country_id', 250)
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1557,8 +1686,9 @@ functions:
.lte('country_id', 250)
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1567,14 +1697,16 @@ functions:
.execute();
```
- - .like():
+ - id: like
+ title: like()
description: |
Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive).
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.like'
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1582,8 +1714,9 @@ functions:
.like('name', '%la%')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1591,8 +1724,9 @@ functions:
.like('name', '%la%')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1600,8 +1734,9 @@ functions:
.like('name', '%la%')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1610,13 +1745,15 @@ functions:
.execute();
```
- - .ilike():
+ - id: ilike
+ title: ilike()
description: |
Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive).
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1624,8 +1761,9 @@ functions:
.ilike('name', '%la%')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1633,8 +1771,9 @@ functions:
.ilike('name', '%la%')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1642,8 +1781,9 @@ functions:
.ilike('name', '%la%')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1652,15 +1792,17 @@ functions:
.execute();
```
- - .is_():
+ - id: is
+ title: is_()
description: |
A check for exact equality (null, true, false), finds all rows whose value on the stated `column` exactly match the specified `value`.
`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1668,8 +1810,9 @@ functions:
.is_('name', null)
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1677,8 +1820,9 @@ functions:
.is_('name', null)
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1686,8 +1830,9 @@ functions:
.is_('name', null)
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1696,15 +1841,17 @@ functions:
.execute();
```
- - .in_():
+ - id: in
+ title: in_()
description: |
Finds all rows whose value on the stated `column` is found on the specified `values`.
`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords.
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1712,8 +1859,9 @@ functions:
.in_('name', ['Rio de Janeiro', 'San Francisco'])
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1721,8 +1869,9 @@ functions:
.in_('name', ['Rio de Janeiro', 'San Francisco'])
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -1730,8 +1879,9 @@ functions:
.in_('name', ['Rio de Janeiro', 'San Francisco'])
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1740,11 +1890,13 @@ functions:
.execute();
```
- - .contains():
+ - id: contains
+ title: contains()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1752,8 +1904,9 @@ functions:
.contains('main_exports', ['oil'])
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1761,8 +1914,9 @@ functions:
.contains('main_exports', ['oil'])
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1770,8 +1924,9 @@ functions:
.contains('main_exports', ['oil'])
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1780,11 +1935,13 @@ functions:
.execute();
```
- - .containedBy():
+ - id: contained-by
+ title: containedBy()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1792,8 +1949,9 @@ functions:
.containedBy('main_exports', ['cars', 'food', 'machine'])
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1801,8 +1959,9 @@ functions:
.containedBy('main_exports', ['orks', 'surveillance', 'evil'])
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1810,8 +1969,9 @@ functions:
.containedBy('main_exports', ['cars', 'food', 'machine'])
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1820,11 +1980,13 @@ functions:
.execute();
```
- - .rangeLt():
+ - id: range-lt
+ title: rangeLt()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1832,8 +1994,9 @@ functions:
.rangeLt('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1841,8 +2004,9 @@ functions:
.rangeLt('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1850,8 +2014,9 @@ functions:
.rangeLt('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1860,11 +2025,13 @@ functions:
.execute();
```
- - .rangeGt():
+ - id: range-gt
+ title: rangeGt()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1872,8 +2039,9 @@ functions:
.rangeGt('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1881,8 +2049,9 @@ functions:
.rangeGt('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1890,8 +2059,9 @@ functions:
.rangeGt('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1900,11 +2070,13 @@ functions:
.execute();
```
- - .rangeGte():
+ - id: range-gte
+ title: rangeGte()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1912,8 +2084,9 @@ functions:
.rangeGte('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1921,8 +2094,9 @@ functions:
.rangeGte('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1930,8 +2104,9 @@ functions:
.rangeGte('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1940,12 +2115,14 @@ functions:
.execute();
```
- - .rangeLte():
+ - id: range-lte
+ title: rangeLte()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeLte'
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1953,8 +2130,9 @@ functions:
.rangeLte('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1962,8 +2140,9 @@ functions:
.rangeLte('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1971,8 +2150,9 @@ functions:
.rangeLte('population_range_millions', '[150, 250]')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -1981,11 +2161,13 @@ functions:
.execute();
```
- - .rangeAdjacent():
+ - id: range-adjacent
+ title: rangeAdjacent()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -1993,8 +2175,9 @@ functions:
.rangeAdjacent('population_range_millions', '[70, 185]')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -2002,8 +2185,9 @@ functions:
.rangeAdjacent('population_range_millions', '[70, 185]')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -2011,8 +2195,9 @@ functions:
.rangeAdjacent('population_range_millions', '[70, 185]')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -2021,11 +2206,13 @@ functions:
.execute();
```
- - .overlaps():
+ - id: overlaps
+ title: overlaps()
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -2033,8 +2220,9 @@ functions:
.overlaps('main_exports', ['computers', 'minerals'])
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -2042,8 +2230,9 @@ functions:
.overlaps('main_exports', ['computers', 'minerals'])
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('countries')
@@ -2051,8 +2240,9 @@ functions:
.overlaps('main_exports', ['computers', 'minerals'])
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
@@ -2061,71 +2251,77 @@ functions:
.execute();
```
- - .textSearch():
+ - id: text-search
+ title: textSearch()
description: |
Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query).
examples:
- - name: Text search
- dart: |
+ - id: text-search
+ name: Text search
+ code: |
```dart
final res = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat' & 'cat'",
- config: 'english'
+ .textSearch('catchphrase', "'fat' & 'cat'",
+ config: 'english'
)
.execute();
```
- - name: Basic normalization
+ - id: basic-normalization
+ name: Basic normalization
description: Uses PostgreSQL's `plainto_tsquery` function.
- dart: |
+ code: |
```dart
final res = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat' & 'cat'",
+ .textSearch('catchphrase', "'fat' & 'cat'",
type: TextSearchType.plain,
- config: 'english'
+ config: 'english'
)
.execute();
```
- - name: Full normalization
+ - id: full-normalization
+ name: Full normalization
description: Uses PostgreSQL's `phraseto_tsquery` function.
- dart: |
+ code: |
```dart
final res = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat' & 'cat'",
+ .textSearch('catchphrase', "'fat' & 'cat'",
type: TextSearchType.phrase,
- config: 'english'
+ config: 'english'
)
.execute();
```
- - name: Full normalization
+ - id: full-normalization
+ name: Full normalization
description: |
- Uses PostgreSQL's `websearch_to_tsquery` function.
- This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
+ Uses PostgreSQL's `websearch_to_tsquery` function.
+ This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
with advanced operators.
- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
- - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery.
+ - `"quoted text"`: text inside quote marks will be converted to terms separated by `<->` operators, as if processed by phraseto_tsquery.
- `OR`: the word “or” will be converted to the | operator.
- `-`: a dash will be converted to the ! operator.
- dart: |
+ code: |
```dart
final res = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat or cat'",
+ .textSearch('catchphrase', "'fat or cat'",
type: TextSearchType.websearch,
config: 'english'
)
.execute();
```
- - .filter():
+ - id: filter
+ title: filter()
description: |
Finds all rows whose `column` satisfies the filter.
notes: |
@@ -2137,9 +2333,10 @@ functions:
.filter('id','cs','{${mylist.join(',')}}') // You can insert a Dart array list.
```
examples:
- - name: With `select()`
+ - id: with-select
+ name: With `select()`
isSpotlight: true
- dart: |
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -2147,8 +2344,9 @@ functions:
.filter('name', 'in', '("Paris","Tokyo")')
.execute();
```
- - name: With `update()`
- dart: |
+ - id: with-update
+ name: With `update()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -2156,8 +2354,9 @@ functions:
.filter('name', 'in', '("Paris","Tokyo")')
.execute();
```
- - name: With `delete()`
- dart: |
+ - id: with-delete
+ name: With `delete()`
+ code: |
```dart
final res = await supabase
.from('cities')
@@ -2165,16 +2364,18 @@ functions:
.filter('name', 'in', '("Paris","Tokyo")')
.execute();
```
- - name: With `rpc()`
- dart: |
+ - id: with-rpc
+ name: With `rpc()`
+ code: |
```dart
// Only valid if the Stored Procedure returns a table type.
final res = await supabase
.rpc('echo_all_cities')
.filter('name', 'in', '("Paris","Tokyo")')
```
- - name: Filter embedded resources
- dart: |
+ - id: filter-embedded-resources
+ name: Filter embedded resources
+ code: |
```dart
final res = await supabase
.from('cities')
diff --git a/spec/supabase_dart_v1_temp_new_shape.yml b/spec/supabase_dart_v1_temp_new_shape.yml
index 04997e1ff5b..ebd61dc527a 100644
--- a/spec/supabase_dart_v1_temp_new_shape.yml
+++ b/spec/supabase_dart_v1_temp_new_shape.yml
@@ -16,7 +16,7 @@ info:
version: '0.0.1'
functions:
- - id: auth.signUp()
+ - id: sign-up
title: 'signUp()'
description: |
Creates a new user.
@@ -30,7 +30,7 @@ functions:
- If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned.
- If **Confirm email** is disabled, the error message, `User already registered` is returned.
examples:
- - id: sign-up.
+ - id: sign-up
name: Sign up.
isSpotlight: true
code: |
@@ -42,13 +42,13 @@ functions:
final Session? session = res.session;
final User? user = res.user;
```
- - id: sign-up-with-third-party-providers.
+ - id: sign-up-with-third-party-providers
name: Sign up with third-party providers.
hideCodeBlock: true
description: |
If you are using Flutter, you can sign up with OAuth providers using the [`signInWithOAuth()`](/docs/reference/dart/auth-signinwithoauth) method available on `supabase_flutter`.
- - id: auth.signInWithPassword()
+ - id: sign-in-with-password
title: 'signInWithPassword()'
description: |
Log in an existing user using email or phone number with password.
@@ -78,7 +78,7 @@ functions:
final Session? session = res.session;
final User? user = res.user;
```
- - id: auth.signInWithOtp()
+ - id: sign-in-with-otp
title: 'signInWithOtp()'
notes: |
- Requires either an email or phone number.
@@ -87,7 +87,7 @@ functions:
- If you're using phone, you can configure whether you want the user to receive a OTP.
- The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings).
examples:
- - id: sign-in-with-email.
+ - id: sign-in-with-email
name: Sign in with email.
isSpotlight: true
description: |
@@ -100,7 +100,7 @@ functions:
emailRedirectTo: kIsWeb ? null : 'io.supabase.flutter://signin-callback/',
);
```
- - id: sign-in-with-sms-otp.
+ - id: sign-in-with-sms-otp
name: Sign in with SMS OTP.
description: The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds.
code: |
@@ -109,7 +109,7 @@ functions:
phone: '+13334445555',
);
```
- - id: auth.signInWithOAuth()
+ - id: sign-in-with-oauth
title: 'signInWithOAuth()'
description: |
Signs the user in using third party OAuth providers.
@@ -124,7 +124,7 @@ functions:
```dart
await supabase.auth.signInWithOAuth(Provider.github);
```
- - id: with`redirectto`
+ - id: sign-in-using-a-third-party-provider-with-redirect
name: With `redirectTo`
description: |
Specify the redirect link to bring back the user via deeplink.
@@ -136,7 +136,7 @@ functions:
redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
);
```
- - id: with-scopes
+ - id: sign-in-with-scopes
name: With scopes
description: |
If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.
@@ -153,7 +153,7 @@ functions:
final Session? session = supabase.auth.currentSession;
final String? oAuthToken = session?.providerToken;
```
- - id: auth.signOut()
+ - id: sign-out
title: 'signOut()'
description: |
Signs out the current user, if there is a logged in user.
@@ -167,7 +167,7 @@ functions:
```dart
await supabase.auth.signOut();
```
- - id: auth.verifyOtp()
+ - id: verify-otp
title: 'verifyOtp()'
notes: |
- The `verifyOtp` method takes in different verification types. If a phone number is used, the type can either be `sms` or `phone_change`. If an email address is used, the type can be one of the following: `signup`, `magiclink`, `recovery`, `invite` or `email_change`.
@@ -199,7 +199,7 @@ functions:
final Session? session = res.session;
final User? user = res.user;
```
- - id: auth.currentSession
+ - id: get-session
title: 'currentSession'
description: |
Returns the session data, if there is an active session.
@@ -211,19 +211,18 @@ functions:
```dart
final Session? session = supabase.auth.currentSession;
```
- - id: auth.currentUser
+ - id: get-user
title: 'currentUser'
description: |
Returns the user data, if there is a logged in user.
examples:
- - id: get-the-logged-in-user
- name: Get the logged in user
+ - name: Get the logged in user
isSpotlight: true
code: |
```dart
final User? user = supabase.auth.currentUser;
```
- - id: auth.updateUser()
+ - id: update-user
title: 'updateUser()'
description: |
Updates user data, if there is a logged in user.
@@ -257,7 +256,7 @@ functions:
);
final User? updatedUser = res.user;
```
- - id: update-the-user's-metadata
+ - id: update-the-users-metadata
name: Update the user's metadata
isSpotlight: true
code: |
@@ -269,7 +268,7 @@ functions:
);
final User? updatedUser = res.user;
```
- - id: auth.onAuthStateChange()
+ - id: on-auth-state-change
title: 'onAuthStateChange()'
description: |
Receive a notification every time an auth event happens.
@@ -286,7 +285,7 @@ functions:
final Session? session = data.session;
});
```
- - id: listen-to-a-specific-event
+ - id: list-to-a-specific-event
name: Listen to a specific event
code: |
```dart
@@ -305,7 +304,7 @@ functions:
authSubscription.cancel();
```
- - id: auth.resetPasswordForEmail
+ - id: auth-reset-password-for-email
title: 'resetPasswordForEmail()'
description: |
Sends a reset request to an email address.
@@ -319,18 +318,18 @@ functions:
);
```
examples:
- - id: reset-password-for-flutter
+ - id: reset-password
name: Reset password for Flutter
isSpotlight: true
code: |
- `redirectTo` is used to open the app via deeplink when user opens the password reset email.
+ `redirectTo` is used to open the app via deeplink when user opens the password reset email.
```dart
await supabase.auth.resetPasswordForEmail(
redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
);
```
- - id: invoke()
+ - id: invoke
title: 'invoke()'
description: |
Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions.
@@ -338,7 +337,7 @@ functions:
- Requires an Authorization header.
- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.
examples:
- - id: basic-invocation.
+ - id: basic-invocation
name: Basic invocation.
isSpotlight: true
code: |
@@ -346,7 +345,7 @@ functions:
final res = await supabase.functions.invoke('hello', body: {'foo': 'baa'});
final data = res.data;
```
- - id: specifying-response-type.
+ - id: specifying-response-type
name: Specifying response type.
description: |
By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`.
@@ -360,7 +359,7 @@ functions:
);
final data = res.data;
```
- - id: parsing-custom-headers.
+ - id: parsing-custom-headers
name: Parsing custom headers.
description: |
Any `headers` will be passed through to the function. A common pattern is to pass a logged-in user's JWT token as an Authorization header.
@@ -375,7 +374,7 @@ functions:
},
);
```
- - id: select()
+ - id: select
description: |
Performs vertical filtering with SELECT.
title: 'Fetch data: select()'
@@ -424,11 +423,11 @@ functions:
- id: query-the-same-foreign-table-multiple-times
name: Query the same foreign table multiple times
description: |
- Sometimes you will need to query the same foreign table twice.
- In this case, you can use the name of the joined column to identify
- which join you intend to use. For convenience, you can also give an
- alias for each column. For example, if we had a shop of products,
- and we wanted to get the supplier and the purchaser at the same time
+ Sometimes you will need to query the same foreign table twice.
+ In this case, you can use the name of the joined column to identify
+ which join you intend to use. For convenience, you can also give an
+ alias for each column. For example, if we had a shop of products,
+ and we wanted to get the supplier and the purchaser at the same time
(both in the users) table:
code: |
```dart
@@ -440,7 +439,7 @@ functions:
- id: filtering-with-inner-joins
name: Filtering with inner joins
description: |
- If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted
+ If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted
to select all rows in a `message` table which belong to a user with the `username` "Jane":
code: |
```dart
@@ -468,10 +467,10 @@ functions:
- id: querying-json-data
name: Querying JSON data
description: |
- If you have data inside of a JSONB column, you can apply select
- and query filters to the data values. Postgres offers a
- [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
- for querying JSON data. Also see
+ If you have data inside of a JSONB column, you can apply select
+ and query filters to the data values. Postgres offers a
+ [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
+ for querying JSON data. Also see
[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details.
code: |
```dart
@@ -495,7 +494,7 @@ functions:
.csv();
```
- - id: insert()
+ - id: insert
description: |
Performs an INSERT into the table.
title: 'Create data: insert()'
@@ -519,7 +518,7 @@ functions:
]);
```
- - id: update()
+ - id: update
description: |
Performs an UPDATE on the table.
title: 'Modify data: update()'
@@ -539,9 +538,9 @@ functions:
- id: updating-json-data
name: Updating JSON data
description: |
- Postgres offers a
- [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
- for working with JSON data. Right now it is only possible to update an entire JSON document,
+ Postgres offers a
+ [number of operators](https://www.postgresql.org/docs/current/functions-json.html)
+ for working with JSON data. Right now it is only possible to update an entire JSON document,
but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys.
code: |
```dart
@@ -556,12 +555,12 @@ functions:
.eq('address->postcode', 90210);
```
- - id: upsert()
+ - id: upsert
description: |
Performs an UPSERT into the table.
title: 'Upsert data: upsert()'
notes: |
- - Primary keys should be included in the data payload in order for an update to work correctly.
+ - Primary keys should be included in the data payload in order for an update to work correctly.
- Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys.
examples:
- id: upsert-your-data
@@ -576,8 +575,8 @@ functions:
- id: upserting-into-tables-with-constraints
name: Upserting into tables with constraints
description: |
- Running the following will cause supabase to upsert data into the `users` table.
- If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row
+ Running the following will cause supabase to upsert data into the `users` table.
+ If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row
based on the column passed into `onConflict`.
isSpotlight: true
code: |
@@ -601,7 +600,7 @@ functions:
final count = res.count;
```
- - id: delete()
+ - id: delete
description: |
Performs a DELETE on the table.
title: 'Delete data: delete()'
@@ -619,7 +618,7 @@ functions:
.match({ 'id': 666 });
```
- - id: rpc()
+ - id: rpc
title: 'Stored Procedures: rpc()'
description: |
You can call stored procedures as a "Remote Procedure Call".
@@ -644,7 +643,7 @@ functions:
.rpc('echo_city', params: { 'name': 'The Shire' });
```
- - id: subscribe()
+ - id: subscribe
description: |
Subscribe to realtime changes in your database.
title: 'on().subscribe()'
@@ -692,8 +691,8 @@ functions:
- id: listening-to-updates
name: Listening to updates
description: |
- By default, Supabase will send only the updated record. If you want to receive the previous values as well you can
- enable full replication for the table you are listening too:
+ By default, Supabase will send only the updated record. If you want to receive the previous values as well you can
+ enable full replication for the table you are listening too:
```sql
alter table "your_table" replica identity full;
@@ -711,8 +710,8 @@ functions:
- id: listening-to-deletes
name: Listening to deletes
description: |
- By default, Supabase does not send deleted records. If you want to receive the deleted record you can
- enable full replication for the table you are listening too:
+ By default, Supabase does not send deleted records. If you want to receive the deleted record you can
+ enable full replication for the table you are listening too:
```sql
alter table "your_table" replica identity full;
@@ -759,14 +758,14 @@ functions:
}).subscribe();
```
- - id: removeChannel()
+ - id: remove-channnel
description: |
Unsubscribes and removes Realtime channel from Realtime client.
title: 'removeChannel()'
notes: |
- Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.
examples:
- - id: remove-a-channel
+ - id: removes-a-channel
name: Remove a channel
isSpotlight: true
code: |
@@ -774,7 +773,7 @@ functions:
final status = await supabase.removeChannel(channel);
```
- - id: removeAllChannels()
+ - id: remove-all-channels
description: |
Unsubscribes and removes all Realtime channels from Realtime client.
title: 'removeAllChannels()'
@@ -789,7 +788,7 @@ functions:
final statuses = await supabase.removeAllChannels();
```
- - id: getChannels()
+ - id: get-channels
description: |
Returns all Realtime channels.
title: 'getChannels()'
@@ -802,7 +801,7 @@ functions:
final channels = supabase.getChannels();
```
- - id: stream()
+ - id: stream
description: |
Notifies of data at the queried table.
title: 'stream()'
@@ -835,7 +834,7 @@ functions:
// Do something awesome with the data
});
```
- - id: with`order()`
+ - id: with-order
name: With `order()`
code: |
```dart
@@ -846,7 +845,7 @@ functions:
// Do something awesome with the data
});
```
- - id: with`limit()`
+ - id: with-limit
name: With `limit()`
code: |
```dart
@@ -858,7 +857,7 @@ functions:
// Do something awesome with the data
});
```
- - id: using`stream()`with`streambuilder`
+ - id: using-stream-with-stream-builder
name: Using `stream()` with `StreamBuilder`
description: |
When using `stream()` with a `StreamBuilder` within your Flutter application, make sure to store your stream in a variable to prevent refetching upon rebuilding.
@@ -889,14 +888,14 @@ functions:
}
```
- - id: storage.listBuckets()
+ - id: list-buckets
description: |
Retrieves the details of all Storage buckets within an existing product.
title: 'listBuckets()'
$ref: '@supabase/storage-js.packages/StorageBucketApi.default.listBuckets'
notes: |
- Policy permissions required:
- - `buckets` permissions: `select`
+ - `buckets` permissions: `select`
- `objects` permissions: none
examples:
- id: list-buckets
@@ -909,14 +908,14 @@ functions:
.listBuckets();
```
- - id: storage.getBucket()
+ - id: get-bucket
description: |
Retrieves the details of an existing Storage bucket.
title: 'getBucket()'
$ref: '@supabase/storage-js.packages/StorageBucketApi.default.getBucket'
notes: |
- Policy permissions required:
- - `buckets` permissions: `select`
+ - `buckets` permissions: `select`
- `objects` permissions: none
examples:
- id: get-bucket
@@ -929,13 +928,13 @@ functions:
.getBucket('avatars');
```
- - id: storage.createBucket()
+ - id: create-bucket
description: |
Creates a new Storage bucket
title: 'createBucket()'
notes: |
- Policy permissions required:
- - `buckets` permissions: `insert`
+ - `buckets` permissions: `insert`
- `objects` permissions: none
examples:
- id: create-bucket
@@ -948,13 +947,13 @@ functions:
.createBucket('avatars');
```
- - id: storage.emptyBucket()
+ - id: empty-bucket
description: |
Removes all objects inside a single bucket.
title: 'emptyBucket()'
notes: |
- Policy permissions required:
- - `buckets` permissions: `select`
+ - `buckets` permissions: `select`
- `objects` permissions: `select` and `delete`
examples:
- id: empty-bucket
@@ -966,7 +965,7 @@ functions:
.storage
.emptyBucket('avatars');
```
- - id: storage.updateBucket()
+ - id: update-bucket
description: |
Updates a new Storage bucket
title: 'updateBucket()'
@@ -985,7 +984,7 @@ functions:
.updateBucket('avatars', const BucketOptions(public: false));
```
- - id: storage.deleteBucket()
+ - id: delete-bucket
description: |
Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket.
title: 'deleteBucket()'
@@ -1004,14 +1003,14 @@ functions:
.deleteBucket('avatars');
```
- - id: storage.from.upload()
+ - id: from-upload
description: |
Uploads a file to an existing bucket.
title: 'from.upload()'
$ref: '@supabase/storage-js.packages/StorageFileApi.default.upload'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `insert`
examples:
- id: upload-file
@@ -1027,13 +1026,13 @@ functions:
);
```
- - id: storage.from.update()
+ - id: from-update
description: |
Replaces an existing file at the specified path with a new one.
title: 'from.update()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `update` and `select`
examples:
- id: update-file
@@ -1049,13 +1048,13 @@ functions:
);
```
- - id: storage.from.move()
+ - id: from-move
description: |
Moves an existing file, optionally renaming it at the same time.
title: 'from.move()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `update` and `select`
examples:
- id: move-file
@@ -1069,13 +1068,13 @@ functions:
.move('public/avatar1.png', 'private/avatar2.png');
```
- - id: storage.from.createSignedUrl()
+ - id: from-create-signed-url
description: |
Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds.
title: 'from.createSignedUrl()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `select`
examples:
- id: create-signed-url
@@ -1089,14 +1088,14 @@ functions:
.createSignedUrl('avatar1.png', 60);
```
- - id: storage.from.getPublicUrl()
+ - id: from-get-public-url
description: |
Retrieve URLs for assets in public buckets
title: 'from.getPublicUrl()'
notes: |
- The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public"
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: none
examples:
- id: returns-the-url-for-an-asset-in-a-public-bucket
@@ -1110,13 +1109,13 @@ functions:
.getPublicUrl('avatar1.png');
```
- - id: storage.from.download()
+ - id: from-download
description: |
Downloads a file.
title: 'from.download()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `select`
examples:
- id: download-file
@@ -1130,13 +1129,13 @@ functions:
.download('avatar1.png');
```
- - id: storage.from.remove()
+ - id: from-remove
description: |
Deletes files within the same bucket
title: 'from.remove()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `delete` and `select`
examples:
- id: delete-file
@@ -1150,13 +1149,13 @@ functions:
.remove(['avatar1.png']);
```
- - id: storage.from.list()
+ - id: from-list
description: |
Lists all the files within a bucket.
title: 'from.list()'
notes: |
- Policy permissions required:
- - `buckets` permissions: none
+ - `buckets` permissions: none
- `objects` permissions: `select`
examples:
- id: list-files-in-a-bucket
@@ -1169,7 +1168,7 @@ functions:
.from('avatars')
.list();
```
- - id: Using Modifiers
+ - id: using-modifiers
title: Using Modifiers
description: |
Filters work on the row level—they allow you to return rows that
@@ -1181,11 +1180,12 @@ functions:
queries that return rows (e.g., `select()` or `rpc()` on a function that
returns a table response).
- - id: limit()
+ - id: limit
+ title: limit()
description: |
Limits the result with the specified count.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1206,11 +1206,12 @@ functions:
.limit(1, foreignTable: 'cities' );
```
- - id: order()
+ - id: order
+ title: order()
description: |
Orders the result with the specified column.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1231,11 +1232,12 @@ functions:
.order('name', foreignTable: 'cities');
```
- - id: range()
+ - id: range
+ title: range()
description: |
Limits the result to rows within the specified range, inclusive.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1246,11 +1248,12 @@ functions:
.range(0,3);
```
- - id: single()
+ - id: single
+ title: single()
description: |
Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1261,12 +1264,12 @@ functions:
.single();
```
- - id: Using Filters
+ - id: using-filters
title: Using Filters
description: |
Filters allow you to only return rows that match certain conditions.
- Filters can be used on `select()`, `update()`, and `delete()` queries.
+ Filters can be used on `select()`, `update()`, and `delete()` queries.
If a Database function returns a table response, you can also apply filters.
@@ -1441,7 +1444,8 @@ functions:
</TabItem>
</Tabs>
- - id: .or()
+ - id: or
+ title: or()
description: |
Finds all rows satisfying at least one of the filters.
notes: |
@@ -1453,7 +1457,7 @@ functions:
.or('id.in.(${mylist.join(',')}),rangecol.cs.(${mylistRange.join(',')}]') // You can insert a Dart list for list or range column.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1463,7 +1467,7 @@ functions:
.select('name, country_id')
.or('id.eq.20,id.eq.30');
```
- - id: use`or`with`and`
+ - id: use-or-with-and
name: Use `or` with `and`
code: |
```dart
@@ -1473,7 +1477,8 @@ functions:
.or('id.gt.20,and(name.eq.New Zealand,name.eq.France)');
```
- - id: .not()
+ - id: not
+ title: not()
description: |
Finds all rows which doesn't satisfy the filter.
notes: |
@@ -1487,7 +1492,7 @@ functions:
.not('id','in','(${mylist.join(',')})') // You can insert a Dart list array.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1497,7 +1502,7 @@ functions:
.select('name, country_id')
.not('name', 'eq', 'Paris');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1506,7 +1511,7 @@ functions:
.update({ 'name': 'Mordor' })
.not('name', 'eq', 'Paris');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1515,7 +1520,7 @@ functions:
.delete()
.not('name', 'eq', 'Paris');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1525,11 +1530,12 @@ functions:
.not('name', 'eq', 'Paris');
```
- - id: .match()
+ - id: match
+ title: match()
description: |
Finds all rows whose columns match the specified `query` object.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1539,7 +1545,7 @@ functions:
.select('name, country_id')
.match({'name': 'Beijing', 'country_id': 156});
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1548,7 +1554,7 @@ functions:
.update({ 'name': 'Mordor' })
.match({'name': 'Beijing', 'country_id': 156});
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1557,7 +1563,7 @@ functions:
.delete()
.match({'name': 'Beijing', 'country_id': 156});
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1567,11 +1573,12 @@ functions:
.match({'name': 'Beijing', 'country_id': 156});
```
- - id: .eq()
+ - id: eq
+ title: eq()
description: |
Finds all rows whose value on the stated `column` exactly matches the specified `value`.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1581,7 +1588,7 @@ functions:
.select('name, country_id')
.eq('name', 'The shire');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1590,7 +1597,7 @@ functions:
.update({ 'name': 'Mordor' })
.eq('name', 'San Francisco');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1599,7 +1606,7 @@ functions:
.delete()
.eq('name', 'Mordor');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1609,11 +1616,12 @@ functions:
.eq('name', 'San Francisco');
```
- - id: .neq()
+ - id: neq
+ title: neq()
description: |
Finds all rows whose value on the stated `column` doesn't match the specified `value`.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1623,7 +1631,7 @@ functions:
.select('name, country_id')
.neq('name', 'The shire');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1632,7 +1640,7 @@ functions:
.update({ 'name': 'Mordor' })
.neq('name', 'San Francisco');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1641,7 +1649,7 @@ functions:
.delete()
.neq('name', 'Mordor');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1651,11 +1659,12 @@ functions:
.neq('name', 'Lagos');
```
- - id: .gt()
+ - id: gt
+ title: gt()
description: |
Finds all rows whose value on the stated `column` is greater than the specified `value`.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1665,7 +1674,7 @@ functions:
.select('name, country_id')
.gt('country_id', 250);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1674,7 +1683,7 @@ functions:
.update({ 'name': 'Mordor' })
.gt('country_id', 250);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1683,7 +1692,7 @@ functions:
.delete()
.gt('country_id', 250);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1693,11 +1702,12 @@ functions:
.gt('country_id', 250);
```
- - id: .gte()
+ - id: gte
+ title: gte()
description: |
Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1707,7 +1717,7 @@ functions:
.select('name, country_id')
.gte('country_id', 250);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1716,7 +1726,7 @@ functions:
.update({ 'name': 'Mordor' })
.gte('country_id', 250);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1725,7 +1735,7 @@ functions:
.delete()
.gte('country_id', 250);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1735,11 +1745,12 @@ functions:
.gte('country_id', 250);
```
- - id: .lt()
+ - id: lt
+ title: lt()
description: |
Finds all rows whose value on the stated `column` is less than the specified `value`.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1749,7 +1760,7 @@ functions:
.select('name, country_id')
.lt('country_id', 250);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1758,7 +1769,7 @@ functions:
.update({ 'name': 'Mordor' })
.lt('country_id', 250);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1767,7 +1778,7 @@ functions:
.delete()
.lt('country_id', 250);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1777,12 +1788,13 @@ functions:
.lt('country_id', 250);
```
- - id: .lte()
+ - id: lte
+ title: lte()
description: |
Finds all rows whose value on the stated `column` is less than or equal to the specified `value`.
$ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1792,7 +1804,7 @@ functions:
.select('name, country_id')
.lte('country_id', 250);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1801,7 +1813,7 @@ functions:
.update({ 'name': 'Mordor' })
.lte('country_id', 250);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1810,7 +1822,7 @@ functions:
.delete()
.lte('country_id', 250);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1820,12 +1832,13 @@ functions:
.lte('country_id', 250);
```
- - id: .like()
+ - id: like
+ title: like()
description: |
Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive).
$ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1835,7 +1848,7 @@ functions:
.select('name, country_id')
.like('name', '%la%');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1844,7 +1857,7 @@ functions:
.update({ 'name': 'Mordor' })
.like('name', '%la%');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1853,7 +1866,7 @@ functions:
.delete()
.like('name', '%la%');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1863,11 +1876,12 @@ functions:
.like('name', '%la%');
```
- - id: .ilike()
+ - id: ilike
+ title: ilike()
description: |
Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive).
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1877,7 +1891,7 @@ functions:
.select('name, country_id')
.ilike('name', '%la%');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1886,7 +1900,7 @@ functions:
.update({ 'name': 'Mordor' })
.ilike('name', '%la%');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1895,7 +1909,7 @@ functions:
.delete()
.ilike('name', '%la%');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1905,13 +1919,14 @@ functions:
.ilike('name', '%la%');
```
- - id: .is_()
+ - id: is
+ title: is_()
description: |
A check for exact equality (null, true, false), finds all rows whose value on the stated `column` exactly match the specified `value`.
`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1921,7 +1936,7 @@ functions:
.select('name, country_id')
.is_('name', null);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1930,7 +1945,7 @@ functions:
.update({ 'name': 'Mordor' })
.is_('name', null);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1939,7 +1954,7 @@ functions:
.delete()
.is_('name', null);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1949,13 +1964,14 @@ functions:
.is_('name', null);
```
- - id: .in_()
+ - id: in
+ title: in_()
description: |
Finds all rows whose value on the stated `column` is found on the specified `values`.
`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords.
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -1965,7 +1981,7 @@ functions:
.select('name, country_id')
.in_('name', ['Rio de Janeiro', 'San Francisco']);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -1974,7 +1990,7 @@ functions:
.update({ 'name': 'Mordor' })
.in_('name', ['Rio de Janeiro', 'San Francisco']);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -1983,7 +1999,7 @@ functions:
.delete()
.in_('name', ['Rio de Janeiro', 'San Francisco']);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -1993,9 +2009,10 @@ functions:
.in_('name', ['Rio de Janeiro', 'San Francisco']);
```
- - id: .contains()
+ - id: contains
+ title: contains()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2005,7 +2022,7 @@ functions:
.select('name, id, main_exports')
.contains('main_exports', ['oil']);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2014,7 +2031,7 @@ functions:
.update({ 'name': 'Mordor' })
.contains('main_exports', ['oil']);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2023,7 +2040,7 @@ functions:
.delete()
.contains('main_exports', ['oil']);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2033,9 +2050,10 @@ functions:
.contains('main_exports', ['oil']);
```
- - id: .containedBy()
+ - id: contained-by
+ title: containedBy()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2045,7 +2063,7 @@ functions:
.select('name, id, main_exports')
.containedBy('main_exports', ['cars', 'food', 'machine']);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2054,7 +2072,7 @@ functions:
.update({ 'name': 'Mordor' })
.containedBy('main_exports', ['orks', 'surveillance', 'evil']);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2063,7 +2081,7 @@ functions:
.delete()
.containedBy('main_exports', ['cars', 'food', 'machine']);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2073,9 +2091,10 @@ functions:
.containedBy('main_exports', ['cars', 'food', 'machine']);
```
- - id: .rangeLt()
+ - id: range-lt
+ title: rangeLt()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2085,7 +2104,7 @@ functions:
.select('name, id, population_range_millions')
.rangeLt('population_range_millions', '[150, 250]');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2094,7 +2113,7 @@ functions:
.update({ 'name': 'Mordor' })
.rangeLt('population_range_millions', '[150, 250]');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2103,7 +2122,7 @@ functions:
.delete()
.rangeLt('population_range_millions', '[150, 250]');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2113,9 +2132,10 @@ functions:
.rangeLt('population_range_millions', '[150, 250]');
```
- - id: .rangeGt()
+ - id: range-gt
+ title: rangeGt()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2125,7 +2145,7 @@ functions:
.select('name, id, population_range_millions')
.rangeGt('population_range_millions', '[150, 250]');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2134,7 +2154,7 @@ functions:
.update({ 'name': 'Mordor' })
.rangeGt('population_range_millions', '[150, 250]');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2143,7 +2163,7 @@ functions:
.delete()
.rangeGt('population_range_millions', '[150, 250]');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2153,9 +2173,10 @@ functions:
.rangeGt('population_range_millions', '[150, 250]');
```
- - id: .rangeGte()
+ - id: range-gte
+ title: rangeGte()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2165,7 +2186,7 @@ functions:
.select('name, id, population_range_millions')
.rangeGte('population_range_millions', '[150, 250]');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2174,7 +2195,7 @@ functions:
.update({ 'name': 'Mordor' })
.rangeGte('population_range_millions', '[150, 250]');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2183,7 +2204,7 @@ functions:
.delete()
.rangeGte('population_range_millions', '[150, 250]');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2193,10 +2214,11 @@ functions:
.rangeGte('population_range_millions', '[150, 250]');
```
- - id: .rangeLte()
+ - id: range-lte
+ title: rangeLte()
$ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2206,7 +2228,7 @@ functions:
.select('name, id, population_range_millions')
.rangeLte('population_range_millions', '[150, 250]');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2215,7 +2237,7 @@ functions:
.update({ 'name': 'Mordor' })
.rangeLte('population_range_millions', '[150, 250]');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2224,7 +2246,7 @@ functions:
.delete()
.rangeLte('population_range_millions', '[150, 250]');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2234,9 +2256,10 @@ functions:
.rangeLte('population_range_millions', [150, 250]);
```
- - id: .rangeAdjacent()
+ - id: range-adjacent
+ title: rangeAdjacent()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2246,7 +2269,7 @@ functions:
.select('name, id, population_range_millions')
.rangeAdjacent('population_range_millions', '[70, 185]');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2255,7 +2278,7 @@ functions:
.update({ 'name': 'Mordor' })
.rangeAdjacent('population_range_millions', '[70, 185]');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2264,7 +2287,7 @@ functions:
.delete()
.rangeAdjacent('population_range_millions', '[70, 185]');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2274,9 +2297,10 @@ functions:
.rangeAdjacent('population_range_millions', '[70, 185]');
```
- - id: .overlaps()
+ - id: overlaps
+ title: overlaps()
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2286,7 +2310,7 @@ functions:
.select('name, id, main_exports')
.overlaps('main_exports', ['computers', 'minerals']);
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2295,7 +2319,7 @@ functions:
.update({ 'name': 'Mordor' })
.overlaps('main_exports', ['computers', 'minerals']);
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2304,7 +2328,7 @@ functions:
.delete()
.overlaps('main_exports', ['computers', 'minerals']);
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
@@ -2314,7 +2338,8 @@ functions:
.overlaps('main_exports', ['computers', 'minerals']);
```
- - id: .textSearch()
+ - id: text-search
+ title: textSearch()
description: |
Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query).
examples:
@@ -2325,8 +2350,8 @@ functions:
final data = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat' & 'cat'",
- config: 'english'
+ .textSearch('catchphrase', "'fat' & 'cat'",
+ config: 'english'
);
```
- id: basic-normalization
@@ -2337,9 +2362,9 @@ functions:
final data = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat' & 'cat'",
+ .textSearch('catchphrase', "'fat' & 'cat'",
type: TextSearchType.plain,
- config: 'english'
+ config: 'english'
);
```
- id: full-normalization
@@ -2350,16 +2375,16 @@ functions:
final data = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat' & 'cat'",
+ .textSearch('catchphrase', "'fat' & 'cat'",
type: TextSearchType.phrase,
- config: 'english'
+ config: 'english'
);
```
- - id: full-normalization
- name: Full normalization
+ - id: web-search
+ name: Websearch
description: |
- Uses PostgreSQL's `websearch_to_tsquery` function.
- This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
+ Uses PostgreSQL's `websearch_to_tsquery` function.
+ This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
with advanced operators.
- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
@@ -2372,13 +2397,14 @@ functions:
final data = await supabase
.from('quotes')
.select('catchphrase')
- .textSearch('catchphrase', "'fat or cat'",
+ .textSearch('catchphrase', "'fat or cat'",
type: TextSearchType.websearch,
config: 'english'
);
```
- - id: .filter()
+ - id: filter
+ title: filter()
description: |
Finds all rows whose `column` satisfies the filter.
notes: |
@@ -2390,7 +2416,7 @@ functions:
.filter('id','cs','{${mylist.join(',')}}') // You can insert a Dart array list.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
code: |
@@ -2400,7 +2426,7 @@ functions:
.select('name, country_id')
.filter('name', 'in', '("Paris","Tokyo")');
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
code: |
```dart
@@ -2409,7 +2435,7 @@ functions:
.update({ 'name': 'Mordor' })
.filter('name', 'in', '("Paris","Tokyo")');
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
code: |
```dart
@@ -2418,7 +2444,7 @@ functions:
.delete()
.filter('name', 'in', '("Paris","Tokyo")');
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
code: |
```dart
diff --git a/spec/supabase_js_v1_temp_new_shape.yml b/spec/supabase_js_v1_temp_new_shape.yml
index 7b64c42d6be..5a12c439455 100644
--- a/spec/supabase_js_v1_temp_new_shape.yml
+++ b/spec/supabase_js_v1_temp_new_shape.yml
@@ -11,12 +11,12 @@ info:
specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1.yml
slugPrefix: '/'
libraries:
- - name: 'JavaScript'
- id: 'js'
+ - id: 'js'
+ name: 'JavaScript'
version: '0.0.1'
functions:
- - id: auth.signUp()
+ - id: sign-up
title: 'signUp()'
$ref: '@supabase/gotrue-js.GoTrueClient.signUp'
notes: |
@@ -29,20 +29,20 @@ functions:
- If "Enable email confirmations" is disabled, an error with a message "User already registered" will be returned.
- To check if a user already exists, refer to getUser().
examples:
- - id: sign-up.
+ - id: sign-up
name: Sign up.
isSpotlight: true
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signUp({
password: 'example-password',
})
```
- - id: sign-up-with-additional-user-meta-data.
+ - id: sign-up-with-additional-user-metadata.
name: Sign up with additional user meta data.
isSpotlight: true
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signUp(
{
@@ -57,16 +57,16 @@ functions:
}
)
```
- - id: sign-up-with-third-party-providers.
+ - id: sign-up-with-third-party-provider
name: Sign up with third-party providers.
hideCodeBlock: true
description: |
You can sign up with OAuth providers using the [`signIn()`](/docs/reference/javascript/v1/auth-signin#sign-in-using-third-party-providers) method.
- - id: sign-up-with-phone.
+ - id: sign-up-with-phone
name: Sign up with Phone.
description: |
Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/v1/auth-signin#sign-in-using-phone) method.
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signUp({
phone: '+13334445555',
@@ -79,7 +79,7 @@ functions:
token: '123456',
})
```
- - id: auth.signIn()
+ - id: sign-in
title: 'signIn()'
$ref: '@supabase/gotrue-js.GoTrueClient.signIn'
notes: |
@@ -88,54 +88,54 @@ functions:
- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
- Specifying a `provider` will open the browser to the relevant login page.
examples:
- - id: sign-in-with-email.
- name: Sign in with email.
+ - id: sign-in-with-email-and-password
+ name: Sign in with email and password
isSpotlight: true
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signIn({
password: 'example-password',
})
```
- - id: sign-in-with-magic-link.
+ - id: sign-in-with-magic-link
name: Sign in with magic link.
description: If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signIn({
})
```
- - id: sign-in-using-third-party-providers.
+ - id: sign-in-with-third-party-provider
name: Sign in using third-party providers.
description: Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signIn({
// provider can be 'github', 'google', 'gitlab', and more
provider: 'github'
})
```
- - id: sign-in-with-phone.
- name: Sign in with Phone.
- description: Supabase supports Phone Auth.
- js: |
+ - id: sign-in-with-phone-and-password
+ name: Sign in with phone and password
+ isSpotlight: false
+ code: |
```js
const { user, session, error } = await supabase.auth.signIn({
phone: '+13334445555',
password: 'some-password',
})
```
- - id: sign-in-with-redirect.
- name: Sign in with redirect.
+ - id: sign-in-using-a-third-party-provider-with-redirect
+ name: Sign in using a third-party provider with redirect
description: |
Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signIn({
provider: 'github'
@@ -143,12 +143,12 @@ functions:
redirectTo: 'https://example.com/welcome'
})
```
- - id: sign-in-with-scopes.
- name: Sign in with scopes.
+ - id: sign-in-with-scopes
+ name: Sign in with scopes
description: |
If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.
You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.
- js: |
+ code: |
```js
const { user, session, error } = await supabase.auth.signIn({
provider: 'github'
@@ -157,11 +157,11 @@ functions:
})
const oAuthToken = session.provider_token // use to access provider API
```
- - id: sign-in-using-a-refresh-token(e.g.in-react-native).
+ - id: sign-in-with-refresh-token
name: Sign in using a refresh token (e.g. in React Native).
description: |
If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
- js: |
+ code: |
```js
// An example using Expo's `AuthSession`
const redirectUri = AuthSession.makeRedirectUri({ useProxy: false });
@@ -178,45 +178,45 @@ functions:
});
```
- - id: auth.signOut()
+ - id: sign-out
title: 'signOut()'
$ref: '@supabase/gotrue-js.GoTrueClient.signOut'
examples:
- id: sign-out
name: Sign out
isSpotlight: true
- js: |
+ code: |
```js
const { error } = await supabase.auth.signOut()
```
- - id: auth.session()
+ - id: get-session
title: 'session()'
$ref: '@supabase/gotrue-js.GoTrueClient.session'
examples:
- id: get-the-session-data
name: Get the session data
isSpotlight: true
- js: |
+ code: |
```js
const session = supabase.auth.session()
```
- - id: auth.user()
+ - id: get-user
title: 'user()'
$ref: '@supabase/gotrue-js.GoTrueClient.user'
notes: |
This method gets the user object from memory.
examples:
- - id: get-the-logged-in-user
+ - id:
name: Get the logged in user
isSpotlight: true
- js: |
+ code: |
```js
const user = supabase.auth.user()
```
- - id: auth.update()
+ - id: update
title: 'update()'
$ref: '@supabase/gotrue-js.GoTrueClient.update'
notes: |
@@ -230,36 +230,36 @@ functions:
name: Update the email for an authenticated user
description: Sends a "Confirm Email Change" email to the new email address.
isSpotlight: true
- js: |
+ code: |
```js
const { user, error } = await supabase.auth.update({email: '[email protected]'})
```
- id: update-the-password-for-an-authenticated-user
name: Update the password for an authenticated user
isSpotlight: true
- js: |
+ code: |
```js
const { user, error } = await supabase.auth.update({password: 'new password'})
```
- - id: update-the-user's-metadata
+ - id: update-the-users-metadata
name: Update the user's metadata
isSpotlight: true
- js: |
+ code: |
```js
const { user, error } = await supabase.auth.update({
data: { hello: 'world' }
})
```
- - id: auth.setAuth()
+ - id: set-auth
title: 'setAuth()'
$ref: '@supabase/gotrue-js.GoTrueClient.setAuth'
examples:
- - id: basic-example.
+ - id: basic-example
name: Basic example.
description: This is most useful on server-side functions where you cannot log the user in, but have access to the user's access token.
isSpotlight: true
- js: |
+ code: |
```js
function apiFunction(req, res) {
// Assuming the access token was sent as a header "X-Supabase-Auth"
@@ -273,10 +273,10 @@ functions:
const { data } = await supabase.from('your_table').select()
}
```
- - id: with-express.
+ - id: with-express
name: With Express.
isSpotlight: true
- js: |
+ code: |
```js
/**
@@ -312,14 +312,14 @@ functions:
}
```
- - id: auth.onAuthStateChange()
+ - id: on-auth-state-change
title: 'onAuthStateChange()'
$ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange'
examples:
- id: listen-to-auth-changes
name: Listen to auth changes
isSpotlight: true
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
console.log(event, session)
@@ -327,7 +327,7 @@ functions:
```
- id: listen-to-sign-in
name: Listen to sign in
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'SIGNED_IN') console.log('SIGNED_IN', session)
@@ -335,7 +335,7 @@ functions:
```
- id: listen-to-sign-out
name: Listen to sign out
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session)
@@ -343,7 +343,7 @@ functions:
```
- id: listen-to-token-refresh
name: Listen to token refresh
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session)
@@ -351,7 +351,7 @@ functions:
```
- id: listen-to-user-updates
name: Listen to user updates
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'USER_UPDATED') console.log('USER_UPDATED', session)
@@ -359,7 +359,7 @@ functions:
```
- id: listen-to-user-deleted
name: Listen to user deleted
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'USER_DELETED') console.log('USER_DELETED', session)
@@ -367,13 +367,13 @@ functions:
```
- id: listen-to-password-recovery-events
name: Listen to password recovery events
- js: |
+ code: |
```js
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session)
})
```
- - id: auth.api.getUser()
+ - id: get-user
title: 'getUser()'
$ref: '@supabase/gotrue-js.GoTrueApi.getUser'
notes: |
@@ -381,32 +381,32 @@ functions:
- Note that user() fetches the user object from local storage which might not be the most updated.
- Requires the user's access_token.
examples:
- - id: fetch-the-user-object-using-the-access-token-jwt.
+ - id: fetch-the-user-object-using-the-access-token-jwt
name: Fetch the user object using the access_token jwt.
isSpotlight: true
- js: |
+ code: |
```js
const { user, error } = await supabase.auth.api.getUser(
'ACCESS_TOKEN_JWT',
)
```
- - id: auth.api.listUsers()
+ - id: list-users
title: 'listUsers()'
$ref: '@supabase/gotrue-js.GoTrueApi.listUsers'
notes: |
- Requires a `service_role` key.
- This function should be called on a server. Never expose your `service_role` key in the browser.
examples:
- - id: get-a-full-list-of-users.
+ - id: get-a-full-list-of-users
name: Get a full list of users.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.listUsers()
```
- - id: auth.api.createUser()
+ - id: create-user
title: 'createUser()'
$ref: '@supabase/gotrue-js.GoTrueApi.createUser'
notes: |
@@ -414,10 +414,10 @@ functions:
- This function should be called on a server. Never expose your `service_role` key in the browser.
- If you do not provide the `email_confirm` and `phone_confirm` options to this function, both will default to false.
examples:
- - id: create-a-new-user.
- name: Create a new user.
+ - id: create-a-new-user-with-custom-user-metadata
+ name: Create a new user with custom user metadata
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.createUser({
@@ -425,20 +425,20 @@ functions:
user_metadata: { name: 'Yoda' }
})
```
- - id: auto-confirm-email.
+ - id: auto-confirm-the-users-email
name: Auto-confirm email.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.createUser({
email_confirm: true
})
```
- - id: auto-confirm-phone.
+ - id: auto-confirm-the-users-phone-number
name: Auto-confirm phone.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.createUser({
phone: '1234567890',
@@ -446,58 +446,58 @@ functions:
})
```
- - id: auth.api.deleteUser()
+ - id: delete-user
title: 'deleteUser()'
$ref: '@supabase/gotrue-js.GoTrueApi.deleteUser'
notes: |
- Requires a `service_role` key.
- This function should be called on a server. Never expose your `service_role` key in the browser.
examples:
- - id: remove-a-user-completely.
+ - id: removes-a-user
name: Remove a user completely.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.deleteUser(
'715ed5db-f090-4b8c-a067-640ecee36aa0'
)
```
- - id: auth.api.inviteUserByEmail()
+ - id: invite-user-by-email
title: 'inviteUserByEmail()'
$ref: '@supabase/gotrue-js.GoTrueApi.inviteUserByEmail'
notes: |
- Requires a `service_role` key.
- This function should only be called on a server. Never expose your `service_role` key in the browser.
examples:
- - id: basic-example.
+ - id: basic-example
name: Basic example.
isSpotlight: false
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth
.api
.inviteUserByEmail('[email protected]')
```
- - id: auth.api.sendMobileOTP()
+ - id: send-mobile-otp
title: 'sendMobileOTP()'
$ref: '@supabase/gotrue-js.GoTrueApi.sendMobileOTP'
notes: |
- Requires a `service_role` key.
- This function should only be called on a server. Never expose your `service_role` key in the browser.
examples:
- - id: basic-example.
+ - id: basic-example
name: Basic example.
isSpotlight: false
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth
.api
.sendMobileOTP('12345879')
```
- - id: auth.api.resetPasswordForEmail()
+ - id: auth-reset-password-for-email
title: 'resetPasswordForEmail()'
$ref: '@supabase/gotrue-js.GoTrueApi.resetPasswordForEmail'
notes: |
@@ -513,16 +513,16 @@ functions:
- id: reset-password
name: Reset password
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase.auth.api.resetPasswordForEmail(
)
```
- - id: reset-password(react)
+ - id: reset-password-react
name: Reset password (React)
isSpotlight: true
- js: |
+ code: |
```js
/**
* Step 1: Send the user an email to get a password reset token.
@@ -551,7 +551,7 @@ functions:
}, [])
```
- - id: auth.api.generateLink()
+ - id: generate-link
title: 'generateLink()'
$ref: '@supabase/gotrue-js.GoTrueApi.generateLink'
notes: |
@@ -561,7 +561,7 @@ functions:
- id: generate-an-invite-link
name: Generate an invite link
isSpotlight: false
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.generateLink(
'invite',
@@ -569,74 +569,74 @@ functions:
)
```
- - id: auth.api.updateUserById()
+ - id: update-user-by-id
title: 'updateUserById()'
$ref: '@supabase/gotrue-js.GoTrueApi.updateUserById'
notes: |
- Requires a `service_role` key.
- This function should only be called on a server. Never expose your `service_role` key in the browser.
examples:
- - id: updates-a-user's-email.
+ - id: updates-a-users-email
name: Updates a user's email.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ email: '[email protected]' }
)
```
- - id: updates-a-user's-password.
+ - id: updates-a-users-password
name: Updates a user's password.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ password: 'new_password' }
)
```
- - id: updates-a-user's-metadata.
+ - id: updates-a-users-metadata
name: Updates a user's metadata.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ user_metadata: { hello: 'world' } }
)
```
- - id: updates-a-user's-app-metadata.
+ - id: updates-a-users-app-metadata
name: Updates a user's app_metadata.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ app_metadata: { plan: 'trial' } }
)
```
- - id: confirms-a-user's-email-address.
+ - id: confirms-a-users-email-address
name: Confirms a user's email address.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ email_confirm: true }
)
```
- - id: confirms-a-user's-phone-number.
+ - id: confirms-a-users-phone-number
name: Confirms a user's phone number.
isSpotlight: true
- js: |
+ code: |
```js
const { data: user, error } = await supabase.auth.api.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ phone_confirm: true }
)
```
- - id: invoke()
+ - id: invoke
title: 'invoke()'
description: |
Invokes a Supabase Function.
@@ -645,33 +645,32 @@ functions:
- Requires an Authorization header.
- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.
examples:
- - id: basic-invocation.
+ - id: basic-invocation
name: Basic invocation.
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase.functions.invoke('hello', {
body: JSON.stringify({ foo: 'bar' })
})
```
- - id: specifying-response-type.
- name: Specifying response type.
+ - name: Specifying response type.
description: |
By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`.
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase.functions.invoke('hello', {
responseType: 'text',
body: JSON.stringify({ foo: 'bar' })
})
```
- - id: parsing-custom-headers.
- name: Parsing custom headers.
+ - id: passing-custom-headers
+ name: Passing custom headers.
description: |
You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT.
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase.functions.invoke('hello', {
headers: {
@@ -681,7 +680,7 @@ functions:
})
```
- - id: select()
+ - id: select
title: 'Fetch data: select()'
$ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.select'
notes: |
@@ -693,7 +692,7 @@ functions:
- id: getting-your-data
name: Getting your data
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -702,7 +701,7 @@ functions:
- id: selecting-specific-columns
name: Selecting specific columns
description: You can select specific fields from your tables.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -711,7 +710,7 @@ functions:
- id: query-foreign-tables
name: Query foreign tables
description: If your database has foreign key relationships, you can query related tables too.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
@@ -736,7 +735,7 @@ functions:
alias for each column. For example, if we had a shop of products,
and we wanted to get the supplier and the purchaser at the same time
(both in the users) table:
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('products')
@@ -751,7 +750,7 @@ functions:
description: |
If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted
to select all rows in a `message` table which belong to a user with the `username` "Jane":
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('messages')
@@ -763,7 +762,7 @@ functions:
description: |
You can get the number of rows by using the count option.
Allowed values for count option are `null`, [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count).
- js: |
+ code: |
```js
const { data, error, count } = await supabase
.from('cities')
@@ -777,7 +776,7 @@ functions:
[number of operators](https://www.postgresql.org/docs/current/functions-json.html)
for querying JSON data. Also see
[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('users')
@@ -787,22 +786,20 @@ functions:
`)
.eq('address->postcode', 90210)
```
- - id: return-data-as-csv
- name: Return data as CSV
+ - name: Return data as CSV
description: |
By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('users')
.select()
.csv()
```
- - id: aborting-requests-in-flight
- name: Aborting requests in-flight
+ - name: Aborting requests in-flight
description: |
You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` doesn't mean anything for aborted requests, since the request wasn't actually fulfilled.
- js: |
+ code: |
```js
const ac = new AbortController()
supabase
@@ -826,7 +823,7 @@ functions:
// }
```
- - id: insert()
+ - id: insert
title: 'Create data: insert()'
$ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.insert'
notes: |
@@ -837,7 +834,7 @@ functions:
- id: create-a-record
name: Create a record
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -850,7 +847,7 @@ functions:
description: |
When running a bulk create, the operation is handled in a single transaction. If any of the inserts fail, all other operations are
rolled back.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -867,7 +864,7 @@ functions:
used must be natural, not surrogate. There are however,
[workarounds](https://github.com/PostgREST/postgrest/issues/1118)
for surrogate primary keys.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -880,7 +877,7 @@ functions:
{ upsert: true })
```
- - id: update()
+ - id: update
title: 'Modify data: update()'
$ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.update'
notes: |
@@ -889,7 +886,7 @@ functions:
- id: updating-your-data
name: Updating your data
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -903,7 +900,7 @@ functions:
[number of operators](https://www.postgresql.org/docs/current/functions-json.html)
for working with JSON data. Right now it is only possible to update an entire JSON document,
but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('users')
@@ -916,7 +913,7 @@ functions:
.eq('address->postcode', 90210)
```
- - id: upsert()
+ - id: upsert
title: 'Upsert data: upsert()'
$ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.upsert'
notes: |
@@ -927,7 +924,7 @@ functions:
- id: upsert-your-data
name: Upsert your data
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('messages')
@@ -936,7 +933,7 @@ functions:
- id: bulk-upsert-your-data
name: Bulk Upsert your data
isSpotlight: false
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('messages')
@@ -952,16 +949,15 @@ functions:
If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row
based on the column passed into `onConflict`.
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('users')
.upsert({ username: 'supabot' }, { onConflict: 'username' })
```
- - id: return-the-exact-number-of-rows
- name: Return the exact number of rows
+ - name: Return the exact number of rows
isSpotlight: true
- js: |
+ code: |
```js
const { data, error, count } = await supabase
.from('users')
@@ -973,7 +969,7 @@ functions:
})
```
- - id: delete()
+ - id: delete
title: 'Delete data: delete()'
$ref: '@supabase/postgrest-js."lib/PostgrestQueryBuilder".PostgrestQueryBuilder.delete'
notes: |
@@ -987,7 +983,7 @@ functions:
- id: delete-records
name: Delete records
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -995,7 +991,7 @@ functions:
.match({ id: 666 })
```
- - id: rpc()
+ - id: rpc
title: 'Postgres functions: rpc()'
description: |
You can call Postgres functions as _Remote Procedure Calls_, logic in your database that you can execute from anywhere.
@@ -1011,14 +1007,14 @@ functions:
- id: call-a-postgres-function-without-arguments
name: Call a Postgres function without arguments
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.rpc('hello_world')
```
- id: call-a-postgres-function-with-arguments
name: Call a Postgres function with arguments
- js: |
+ code: |
```js
const { data, error } = await supabase
.rpc('echo_city', { name: 'The Shire' })
@@ -1026,7 +1022,7 @@ functions:
- id: bulk-processing
name: Bulk processing
description: You can process large payloads at once using [array parameters](https://postgrest.org/en/stable/api.html#calling-functions-with-array-parameters).
- js: |
+ code: |
```js
const { data, error } = await postgrest
.rpc('echo_cities', { names: ['The Shire', 'Mordor'] })
@@ -1037,25 +1033,25 @@ functions:
Postgres functions that return tables can also be combined with
[Modifiers](/docs/reference/javascript/using-modifiers) and
[Filters](/docs/reference/javascript/using-filters).
- js: |
+ code: |
```js
const { data, error } = await supabase
.rpc('echo_all_cities')
.select('name, population')
.eq('name', 'The Shire')
```
- - id: call-a-postgres-function-with-a-count-option
+ - id: call-a-postgres-function-with-count-option
name: Call a Postgres function with a count option
description: |
You can specify a count option to get the row count along with your data.
Allowed values for count option are `null`, `exact`, `planned` and `estimated`.
- js: |
+ code: |
```js
const { data, error, count } = await supabase
.rpc('hello_world', {}, { count: 'exact' })
```
- - id: subscribe()
+ - id: subscribe
title: 'on().subscribe()'
$ref: '@supabase/supabase-js.lib/SupabaseQueryBuilder.SupabaseQueryBuilder.on'
notes: |
@@ -1065,7 +1061,7 @@ functions:
- id: listen-to-all-database-changes
name: Listen to all database changes
isSpotlight: true
- js: |
+ code: |
```js
const mySubscription = supabase
.from('*')
@@ -1076,7 +1072,7 @@ functions:
```
- id: listening-to-a-specific-table
name: Listening to a specific table
- js: |
+ code: |
```js
const mySubscription = supabase
.from('countries')
@@ -1087,7 +1083,7 @@ functions:
```
- id: listening-to-inserts
name: Listening to inserts
- js: |
+ code: |
```js
const mySubscription = supabase
.from('countries')
@@ -1105,7 +1101,7 @@ functions:
```sql
alter table "your_table" replica identity full;
```
- js: |
+ code: |
```js
const mySubscription = supabase
.from('countries')
@@ -1123,7 +1119,7 @@ functions:
```sql
alter table "your_table" replica identity full;
```
- js: |
+ code: |
```js
const mySubscription = supabase
.from('countries')
@@ -1135,7 +1131,7 @@ functions:
- id: listening-to-multiple-events
name: Listening to multiple events
description: You can chain listeners if you want to listen to multiple events for each table.
- js: |
+ code: |
```js
const mySubscription = supabase
.from('countries')
@@ -1148,7 +1144,7 @@ functions:
description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.
notes: |
- ``eq`` filter works with all database types as under the hood, it's casting both the filter value and the database value to the correct type and then comparing them.
- js: |
+ code: |
```js
const mySubscription = supabase
.from('countries:id=eq.200')
@@ -1156,7 +1152,7 @@ functions:
.subscribe()
```
- - id: removeSubscription()
+ - id: remove-subscription
title: 'removeSubscription()'
$ref: '@supabase/supabase-js.index.SupabaseClient.removeSubscription'
notes: |
@@ -1165,12 +1161,12 @@ functions:
- id: remove-a-subscription
name: Remove a subscription
isSpotlight: true
- js: |
+ code: |
```js
supabase.removeSubscription(mySubscription)
```
- - id: removeAllSubscriptions()
+ - id: remove-all-subscriptions
title: 'removeAllSubscriptions()'
$ref: '@supabase/supabase-js.index.SupabaseClient.removeAllSubscriptions'
notes: |
@@ -1179,24 +1175,24 @@ functions:
- id: removes-all-subscriptions
name: Removes all subscriptions
isSpotlight: true
- js: |
+ code: |
```js
supabase.removeAllSubscriptions()
```
- - id: getSubscriptions()
+ - id: get-subscriptions
title: 'getSubscriptions()'
$ref: '@supabase/supabase-js.index.SupabaseClient.getSubscriptions'
examples:
- id: get-all-subscriptions
name: Get all subscriptions
isSpotlight: true
- js: |
+ code: |
```js
const subscriptions = supabase.getSubscriptions()
```
- - id: storage.listBuckets()
+ - id: list-buckets
title: 'listBuckets()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.listBuckets'
notes: |
@@ -1207,14 +1203,14 @@ functions:
- id: list-buckets
name: List buckets
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
.listBuckets()
```
- - id: storage.getBucket()
+ - id: get-bucket
title: 'getBucket()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.getBucket'
notes: |
@@ -1225,14 +1221,14 @@ functions:
- id: get-bucket
name: Get bucket
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
.getBucket('avatars')
```
- - id: storage.createBucket()
+ - id: create-bucket
title: 'createBucket()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.createBucket'
notes: |
@@ -1243,14 +1239,14 @@ functions:
- id: create-bucket
name: Create bucket
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
.createBucket('avatars', { public: false })
```
- - id: storage.emptyBucket()
+ - id: empty-bucket
title: 'emptyBucket()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.emptyBucket'
notes: |
@@ -1261,13 +1257,13 @@ functions:
- id: empty-bucket
name: Empty bucket
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
.emptyBucket('avatars')
```
- - id: storage.updateBucket()
+ - id: update-bucket
title: 'updateBucket()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.updateBucket'
notes: |
@@ -1278,14 +1274,14 @@ functions:
- id: update-bucket
name: Update bucket
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
.updateBucket('avatars', { public: false })
```
- - id: storage.deleteBucket()
+ - id: delete-bucket
title: 'deleteBucket()'
$ref: '@supabase/storage-js."lib/StorageBucketApi".StorageBucketApi.deleteBucket'
notes: |
@@ -1296,14 +1292,14 @@ functions:
- id: delete-bucket
name: Delete bucket
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
.deleteBucket('avatars')
```
- - id: storage.from.upload()
+ - id: from-upload
title: 'from.upload()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.upload'
notes: |
@@ -1315,7 +1311,7 @@ functions:
- id: upload-file
name: Upload file
isSpotlight: true
- js: |
+ code: |
```js
const avatarFile = event.target.files[0]
const { data, error } = await supabase
@@ -1326,9 +1322,9 @@ functions:
upsert: false
})
```
- - id: upload-file-using`arraybuffer`from-base64-file-data
+ - id: upload-file-using-arraybuffer-from-base64-file-data
name: Upload file using `ArrayBuffer` from base64 file data
- js: |
+ code: |
```js
import { decode } from 'base64-arraybuffer'
@@ -1340,7 +1336,7 @@ functions:
})
```
- - id: storage.from.update()
+ - id: from-update
title: 'from.update()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.update'
notes: |
@@ -1352,7 +1348,7 @@ functions:
- id: update-file
name: Update file
isSpotlight: true
- js: |
+ code: |
```js
const avatarFile = event.target.files[0]
const { data, error } = await supabase
@@ -1363,9 +1359,9 @@ functions:
upsert: false
})
```
- - id: update-file-using`arraybuffer`from-base64-file-data
+ - id: update-file-using-arraybuffer-from-base64-file-data
name: Update file using `ArrayBuffer` from base64 file data
- js: |
+ code: |
```js
import {decode} from 'base64-arraybuffer'
@@ -1377,7 +1373,7 @@ functions:
})
```
- - id: storage.from.move()
+ - id: from-move
title: 'from.move()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.move'
notes: |
@@ -1388,7 +1384,7 @@ functions:
- id: move-file
name: Move file
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1396,7 +1392,7 @@ functions:
.move('public/avatar1.png', 'private/avatar2.png')
```
- - id: storage.from.copy()
+ - id: from-copy
title: 'from.copy()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.copy'
notes: |
@@ -1407,7 +1403,7 @@ functions:
- id: copy-file
name: Copy file
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1415,7 +1411,7 @@ functions:
.copy('public/avatar1.png', 'private/avatar2.png')
```
- - id: storage.from.createSignedUrl()
+ - id: from-create-signed-url
title: 'from.createSignedUrl()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.createSignedUrl'
notes: |
@@ -1426,7 +1422,7 @@ functions:
- id: create-signed-url
name: Create Signed URL
isSpotlight: true
- js: |
+ code: |
```js
const { signedURL, error } = await supabase
.storage
@@ -1434,7 +1430,7 @@ functions:
.createSignedUrl('folder/avatar1.png', 60)
```
- - id: storage.from.createSignedUrls()
+ - id: from-create-signed-urls
title: 'from.createSignedUrls()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.createSignedUrls'
notes: |
@@ -1445,7 +1441,7 @@ functions:
- id: create-signed-urls
name: Create Signed URLs
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1453,7 +1449,7 @@ functions:
.createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)
```
- - id: storage.from.getPublicUrl()
+ - id: from-get-public-url
title: 'from.getPublicUrl()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.getPublicUrl'
notes: |
@@ -1465,7 +1461,7 @@ functions:
- id: returns-the-url-for-an-asset-in-a-public-bucket
name: Returns the URL for an asset in a public bucket
isSpotlight: true
- js: |
+ code: |
```js
const { publicURL, error } = supabase
.storage
@@ -1473,7 +1469,7 @@ functions:
.getPublicUrl('folder/avatar1.png')
```
- - id: storage.from.download()
+ - id: from-download
title: 'from.download()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.download'
notes: |
@@ -1484,7 +1480,7 @@ functions:
- id: download-file
name: Download file
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1492,7 +1488,7 @@ functions:
.download('folder/avatar1.png')
```
- - id: storage.from.remove()
+ - id: from-remove
title: 'from.remove()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.remove'
notes: |
@@ -1503,7 +1499,7 @@ functions:
- id: delete-file
name: Delete file
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1511,7 +1507,7 @@ functions:
.remove(['folder/avatar1.png'])
```
- - id: storage.from.list()
+ - id: from-list
title: 'from.list()'
$ref: '@supabase/storage-js."lib/StorageFileApi".StorageFileApi.list'
notes: |
@@ -1522,7 +1518,7 @@ functions:
- id: list-files-in-a-bucket
name: List files in a bucket
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1535,7 +1531,7 @@ functions:
```
- id: search-files-in-a-bucket
name: Search files in a bucket
- js: |
+ code: |
```js
const { data, error } = await supabase
.storage
@@ -1548,20 +1544,21 @@ functions:
})
```
- - id: Using modifiers
+ - id: using-modifiers
title: Using Modifiers
description: |
Modifiers can be used on `select()` queries.
If a Postgres function returns a table response, you can also apply modifiers to the `rpc()` function.
- - id: limit()
+ - id: limit
+ title: limit()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.limit'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -1570,7 +1567,7 @@ functions:
```
- id: with-embedded-resources
name: With embedded resources
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
@@ -1579,13 +1576,14 @@ functions:
.limit(1, { foreignTable: 'cities' })
```
- - id: order()
+ - id: order
+ title: order()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.order'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -1594,7 +1592,7 @@ functions:
```
- id: with-embedded-resources
name: With embedded resources
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
@@ -1604,7 +1602,7 @@ functions:
```
- id: ordering-multiple-columns
name: Ordering multiple columns
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -1612,13 +1610,14 @@ functions:
.order('country_id', { ascending: false })
.order('name', { ascending: false })
```
- - id: range()
+ - id: range
+ title: range()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.range'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -1626,13 +1625,14 @@ functions:
.range(0,3)
```
- - id: single()
+ - id: single
+ title: single()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.single'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -1641,13 +1641,14 @@ functions:
.single()
```
- - id: maybeSingle()
+ - id: maybeSingle
+ title: maybeSingle()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.maybeSingle'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
@@ -1656,8 +1657,8 @@ functions:
.maybeSingle()
```
- - id: Using Filters
- title: Using filters
+ - id: using-filters
+ title: Using Filters
description: |
Filters can be used on `select()`, `update()`, and `delete()` queries.
@@ -1711,7 +1712,8 @@ functions:
const { data, error } = await query
```
- - id: .or()
+ - id: or
+ title: or()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.or'
notes: |
- `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.
@@ -1722,30 +1724,30 @@ functions:
.or(`id.in.(${arrList}),rangecol.cs.[${arrRange})`) // You can insert a javascipt array for list or range on a range column.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.or('id.eq.20,id.eq.30')
```
- - id: use`or`with`and`
+ - id: use-or-with-and
name: Use `or` with `and`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.or('id.gt.20,and(name.eq.New Zealand,name.eq.France)')
```
- - id: use`or`on-foreign-tables
+ - id: use-or-on-foreign-tables
name: Use `or` on foreign tables
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
@@ -1753,7 +1755,8 @@ functions:
.or('name.eq.Wellington,name.eq.Paris', { foreignTable: "cities" })
```
- - id: .not()
+ - id: not
+ title: not()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.not'
notes: |
- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values.
@@ -1766,37 +1769,37 @@ functions:
.not('id','in',`(${arr})`) // You can insert a javascript array.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.not('name', 'eq', 'Paris')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.not('name', 'eq', 'Paris')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.not('name', 'eq', 'Paris')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -1804,40 +1807,41 @@ functions:
.not('name', 'eq', 'Paris')
```
- - id: .match()
+ - id: match
+ title: match()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.match'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.match({name: 'Beijing', country_id: 156})
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.match({name: 'Beijing', country_id: 156})
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.match({name: 'Beijing', country_id: 156})
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -1845,40 +1849,41 @@ functions:
.match({name: 'Beijing', country_id: 156})
```
- - id: .eq()
+ - id: eq
+ title: eq()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.eq'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.eq('name', 'The shire')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.eq('name', 'San Francisco')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.eq('name', 'Mordor')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -1886,40 +1891,41 @@ functions:
.eq('name', 'San Francisco')
```
- - id: .neq()
+ - id: neq
+ title: neq()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.neq'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.neq('name', 'The shire')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.neq('name', 'San Francisco')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.neq('name', 'Mordor')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -1927,40 +1933,41 @@ functions:
.neq('name', 'Lagos')
```
- - id: .gt()
+ - id: gt
+ title: gt()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.gt'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.gt('country_id', 250)
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.gt('country_id', 250)
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.gt('country_id', 250)
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -1968,40 +1975,41 @@ functions:
.gt('country_id', 250)
```
- - id: .gte()
+ - id: gte
+ title: gte()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.gte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.gte('country_id', 250)
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.gte('country_id', 250)
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.gte('country_id', 250)
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2009,40 +2017,41 @@ functions:
.gte('country_id', 250)
```
- - id: .lt()
+ - id: lt
+ title: lt()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.lt'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.lt('country_id', 250)
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.lt('country_id', 250)
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.lt('country_id', 250)
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2050,40 +2059,41 @@ functions:
.lt('country_id', 250)
```
- - id: .lte()
+ - id: lte
+ title: lte()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.lte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.lte('country_id', 250)
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.lte('country_id', 250)
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.lte('country_id', 250)
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2091,40 +2101,41 @@ functions:
.lte('country_id', 250)
```
- - id: .like()
+ - id: like
+ title: like()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.like'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.like('name', '%la%')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.like('name', '%la%')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.like('name', '%la%')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2132,40 +2143,41 @@ functions:
.like('name', '%la%')
```
- - id: .ilike()
+ - id: ilike
+ title: ilike()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.ilike'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.ilike('name', '%la%')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.ilike('name', '%la%')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.ilike('name', '%la%')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2173,40 +2185,41 @@ functions:
.ilike('name', '%la%')
```
- - id: .is()
+ - id: is
+ title: is()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.is'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.is('name', null)
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.is('name', null)
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.is('name', null)
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2214,40 +2227,41 @@ functions:
.is('name', null)
```
- - id: .in()
+ - id: in
+ title: in()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.in'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.in('name', ['Rio de Janeiro', 'San Francisco'])
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.in('name', ['Rio de Janeiro', 'San Francisco'])
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.in('name', ['Rio de Janeiro', 'San Francisco'])
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2255,7 +2269,8 @@ functions:
.in('name', ['Rio de Janeiro', 'San Francisco'])
```
- - id: .contains()
+ - id: contains
+ title: contains()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.contains'
notes: |
- `.contains()` can work on array columns or range columns.
@@ -2268,37 +2283,37 @@ functions:
.contains('rangecol',`(${arr}]`) // You can insert an array into a string.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, main_exports')
.contains('main_exports', ['oil'])
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.contains('main_exports', ['oil'])
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.contains('main_exports', ['oil'])
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2306,7 +2321,8 @@ functions:
.contains('main_exports', ['oil'])
```
- - id: .containedBy()
+ - id: contained-by
+ title: containedBy()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.containedBy'
notes: |
- `.containedBy()` can work on array columns or range columns.
@@ -2318,37 +2334,37 @@ functions:
.containedBy('rangecol',`(${arr}]`) // You can insert an array into a string.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, main_exports')
.containedBy('main_exports', ['cars', 'food', 'machine'])
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.containedBy('main_exports', ['orks', 'surveillance', 'evil'])
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.containedBy('main_exports', ['cars', 'food', 'machine'])
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2356,40 +2372,41 @@ functions:
.containedBy('main_exports', ['cars', 'food', 'machine'])
```
- - id: .rangeLt()
+ - id: range-lte
+ title: rangeLte()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeLt'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, population_range_millions')
.rangeLt('population_range_millions', '[150, 250]')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.rangeLt('population_range_millions', '[150, 250]')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.rangeLt('population_range_millions', '[150, 250]')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2397,40 +2414,41 @@ functions:
.rangeLt('population_range_millions', '[150, 250]')
```
- - id: .rangeGt()
+ - id: range-gt
+ title: rangeGt()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeGt'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, population_range_millions')
.rangeGt('population_range_millions', '[150, 250]')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.rangeGt('population_range_millions', '[150, 250]')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.rangeGt('population_range_millions', '[150, 250]')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2438,40 +2456,41 @@ functions:
.rangeGt('population_range_millions', '[150, 250]')
```
- - id: .rangeGte()
+ - id: range-gte
+ title: rangeGte()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeGte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, population_range_millions')
.rangeGte('population_range_millions', '[150, 250]')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.rangeGte('population_range_millions', '[150, 250]')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.rangeGte('population_range_millions', '[150, 250]')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2479,40 +2498,41 @@ functions:
.rangeGte('population_range_millions', '[150, 250]')
```
- - id: .rangeLte()
+ - id: range-lte
+ title: rangeLte()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeLte'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, population_range_millions')
.rangeLte('population_range_millions', '[150, 250]')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.rangeLte('population_range_millions', '[150, 250]')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.rangeLte('population_range_millions', '[150, 250]')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2520,40 +2540,41 @@ functions:
.rangeLte('population_range_millions', '[150, 250]')
```
- - id: .rangeAdjacent()
+ - id: range-adjacent
+ title: rangeAdjacent()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.rangeAdjacent'
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, population_range_millions')
.rangeAdjacent('population_range_millions', '[70, 185]')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.update({ name: 'Mordor' })
.rangeAdjacent('population_range_millions', '[70, 185]')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.rangeAdjacent('population_range_millions', '[70, 185]')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2561,7 +2582,8 @@ functions:
.rangeAdjacent('population_range_millions', '[70, 185]')
```
- - id: .overlaps()
+ - id: overlaps
+ title: overlaps()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.overlaps'
notes: |
- `.overlaps()` can work on array columns or range columns.
@@ -2573,37 +2595,37 @@ functions:
.overlaps('rangecol',`(${arr}]`) // You can insert an array into a string.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.select('name, id, main_exports')
.overlaps('main_exports', ['computers', 'minerals'])
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
let countries = await supabase
.from('countries')
.update({ name: 'Mordor' })
.overlaps('main_exports', ['computers', 'minerals'])
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('countries')
.delete()
.overlaps('main_exports', ['computers', 'minerals'])
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2611,12 +2633,13 @@ functions:
.overlaps('main_exports', ['computers', 'minerals'])
```
- - id: .textSearch()
+ - id: text-search
+ title: textSearch()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.textSearch'
examples:
- id: text-search
name: Text search
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('quotes')
@@ -2628,7 +2651,7 @@ functions:
- id: basic-normalization
name: Basic normalization
description: Uses PostgreSQL's `plainto_tsquery` function.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('quotes')
@@ -2641,7 +2664,7 @@ functions:
- id: full-normalization
name: Full normalization
description: Uses PostgreSQL's `phraseto_tsquery` function.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('quotes')
@@ -2651,19 +2674,18 @@ functions:
config: 'english'
})
```
- - id: websearch
+ - id: web-search
name: Websearch
description: |
Uses PostgreSQL's `websearch_to_tsquery` function.
- This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
- with advanced operators.
+ This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used with advanced operators.
- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
- - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery.
+ - `"quoted text"`: text inside quote marks will be converted to terms separated by `<->` operators, as if processed by phraseto_tsquery.
- `OR`: the word “or” will be converted to the | operator.
- `-`: a dash will be converted to the ! operator.
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('quotes')
@@ -2674,7 +2696,8 @@ functions:
})
```
- - id: .filter()
+ - id: filter
+ title: filter()
$ref: '@supabase/postgrest-js."lib/PostgrestFilterBuilder".PostgrestFilterBuilder.filter'
notes: |
- `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work.
@@ -2685,37 +2708,37 @@ functions:
.filter('id','in',`(${arr})`) // You can insert a javascript array.
```
examples:
- - id: with`select()`
+ - id: with-select
name: With `select()`
isSpotlight: true
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.filter('name', 'in', '("Paris","Tokyo")')
```
- - id: with`update()`
+ - id: with-update
name: With `update()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.update({ name: 'Mordor' })
.filter('name', 'in', '("Paris","Tokyo")')
```
- - id: with`delete()`
+ - id: with-delete
name: With `delete()`
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
.delete()
.filter('name', 'in', '("Paris","Tokyo")')
```
- - id: with`rpc()`
+ - id: with-rpc
name: With `rpc()`
- js: |
+ code: |
```js
// Only valid if the Postgres function returns a table type.
const { data, error } = await supabase
@@ -2724,7 +2747,7 @@ functions:
```
- id: filter-embedded-resources
name: Filter embedded resources
- js: |
+ code: |
```js
const { data, error } = await supabase
.from('cities')
diff --git a/spec/supabase_js_v2_temp_new_shape.yml b/spec/supabase_js_v2_temp_new_shape.yml
index 48d21930d79..5ef220244b4 100644
--- a/spec/supabase_js_v2_temp_new_shape.yml
+++ b/spec/supabase_js_v2_temp_new_shape.yml
@@ -16,6 +16,7 @@ info:
functions:
- id: initializing
+ title: 'Initializing'
$ref: '@supabase/supabase-js.index.SupabaseClient.constructor'
description: |
You can initialize a new Supabase client using the `createClient()` method.
@@ -2571,301 +2572,301 @@ functions:
</Tabs>
hideCodeBlock: true
- # - id: using-filters
- # title: Using Filters
- # description: |
- # Filters allow you to only return rows that match certain conditions.
+ - id: using-filters
+ title: Using Filters
+ description: |
+ Filters allow you to only return rows that match certain conditions.
- # Filters can be used on `select()`, `update()`, `upsert()`, and `delete()` queries.
+ Filters can be used on `select()`, `update()`, `upsert()`, and `delete()` queries.
- # If a Postgres function returns a table response, you can also apply filters.
- # examples:
- # - id: applying-filters
- # name: Applying Filters
- # description: |
- # Filters must be applied after any of `select()`, `update()`, `upsert()`,
- # `delete()`, and `rpc()` and before
- # [modifiers](/docs/reference/javascript/using-modifiers).
- # code: |
- # ```ts
- # const { data, error } = await supabase
- # .from('cities')
- # .select('name, country_id')
- # .eq('name', 'The Shire') // Correct
+ If a Postgres function returns a table response, you can also apply filters.
+ examples:
+ - id: applying-filters
+ name: Applying Filters
+ description: |
+ Filters must be applied after any of `select()`, `update()`, `upsert()`,
+ `delete()`, and `rpc()` and before
+ [modifiers](/docs/reference/javascript/using-modifiers).
+ code: |
+ ```ts
+ const { data, error } = await supabase
+ .from('cities')
+ .select('name, country_id')
+ .eq('name', 'The Shire') // Correct
- # const { data, error } = await supabase
- # .from('cities')
- # .eq('name', 'The Shire') // Incorrect
- # .select('name, country_id')
- # ```
- # - id: chaining-filters
- # name: Chaining
- # description: |
- # Filters can be chained together to produce advanced queries. For example,
- # to query cities with population between 1,000 and 10,000:
-
- # ```ts
- # const { data, error } = await supabase
- # .from('cities')
- # .select('name, country_id')
- # .gte('population', 1000)
- # .lt('population', 10000)
- # ```
- # code: |
- # ```ts
- # const { data, error } = await supabase
- # .from('cities')
- # .select('name, country_id')
- # .gte('population', 1000)
- # .lt('population', 10000)
- # ```
- # - id: conditional-chaining
- # name: Conditional Chaining
- # description: |
- # Filters can be built up one step at a time and then executed. For example:
-
- # ```ts
- # const filterByName = null
- # const filterPopLow = 1000
- # const filterPopHigh = 10000
-
- # let query = supabase
- # .from('cities')
- # .select('name, country_id')
-
- # if (filterByName) { query = query.eq('name', filterByName) }
- # if (filterPopLow) { query = query.gte('population', filterPopLow) }
- # if (filterPopHigh) { query = query.lt('population', filterPopHigh) }
-
- # const { data, error } = await query
- # ```
- # code: |
- # ```ts
- # const filterByName = null
- # const filterPopLow = 1000
- # const filterPopHigh = 10000
-
- # let query = supabase
- # .from('cities')
- # .select('name, country_id')
-
- # if (filterByName) { query = query.eq('name', filterByName) }
- # if (filterPopLow) { query = query.gte('population', filterPopLow) }
- # if (filterPopHigh) { query = query.lt('population', filterPopHigh) }
-
- # const { data, error } = await query
- # ```
- # - id: filter-by-value-within-json-column
- # name: Filter by values within a JSON column
- # code: |
- # ```ts
- # const { data, error } = await supabase
- # .from('users')
- # .select()
- # .eq('address->postcode', 90210)
- # ```
- # data:
- # sql: |
- # ```sql
- # create table
- # users (
- # id int8 primary key,
- # name text,
- # address jsonb
- # );
-
- # insert into
- # users (id, name, address)
- # values
- # (1, 'Michael', '{ "postcode": 90210 }'),
- # (2, 'Jane', null);
- # ```
- # response: |
- # ```json
- # {
- # "data": [
- # {
- # "id": 1,
- # "name": "Michael",
- # "address": {
- # "postcode": 90210
- # }
- # }
- # ],
- # "status": 200,
- # "statusText": "OK"
- # }
- # ```
- # description: |
- # <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">
- # <TabPanel id="schema" label="Schema">
-
- # ```sql
- # create table
- # users (
- # id int8 primary key,
- # name text,
- # address jsonb
- # );
-
- # insert into
- # users (id, name, address)
- # values
- # (1, 'Michael', '{ "postcode": 90210 }'),
- # (2, 'Jane', null);
- # ```
-
- # </TabPanel>
- # <TabPanel id="js" label="JavaScript">
-
- # ```ts
- # const { data, error } = await supabase
- # .from('users')
- # .select()
- # .eq('address->postcode', 90210)
- # ```
-
- # </TabPanel>
- # <TabPanel id="result" label="Result">
-
- # ```json
- # {
- # "data": [
- # {
- # "id": 1,
- # "name": "Michael",
- # "address": {
- # "postcode": 90210
- # }
- # }
- # ],
- # "status": 200,
- # "statusText": "OK"
- # }
- # ```
-
- # </TabPanel>
- # </Tabs>
- # - id: filter-foreign-tables
- # name: Filter Foreign Tables
- # code: |
- # ```ts
- # const { data, error } = await supabase
- # .from('countries')
- # .select(`
- # name,
- # cities!inner (
- # name
- # )
- # `)
- # .eq('cities.name', 'Bali')
- # ```
- # data:
- # sql: |
- # ```sql
- # create table
- # countries (id int8 primary key, name text);
- # create table
- # cities (
- # id int8 primary key,
- # country_id int8 not null references countries,
- # name text
- # );
-
- # insert into
- # countries (id, name)
- # values
- # (1, 'Germany'),
- # (2, 'Indonesia');
- # insert into
- # cities (id, country_id, name)
- # values
- # (1, 2, 'Bali'),
- # (2, 1, 'Munich');
- # ```
- # response: |
- # ```json
- # {
- # "data": [
- # {
- # "name": "Indonesia",
- # "cities": [
- # {
- # "name": "Bali"
- # }
- # ]
- # }
- # ],
- # "status": 200,
- # "statusText": "OK"
- # }
- # ```
- # description: |
- # You can filter on foreign tables in your `select()` query using dot
- # notation:
-
- # <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">
- # <TabPanel id="schema" label="Schema">
-
- # ```sql
- # create table
- # countries (id int8 primary key, name text);
- # create table
- # cities (
- # id int8 primary key,
- # country_id int8 not null references countries,
- # name text
- # );
-
- # insert into
- # countries (id, name)
- # values
- # (1, 'Germany'),
- # (2, 'Indonesia');
- # insert into
- # cities (id, country_id, name)
- # values
- # (1, 2, 'Bali'),
- # (2, 1, 'Munich');
- # ```
-
- # </TabPanel>
- # <TabPanel id="js" label="JavaScript">
-
- # ```ts
- # const { data, error } = await supabase
- # .from('countries')
- # .select(`
- # name,
- # cities!inner (
- # name
- # )
- # `)
- # .eq('cities.name', 'Bali')
- # ```
-
- # </TabPanel>
- # <TabPanel id="result" label="Result">
-
- # ```json
- # {
- # "data": [
- # {
- # "name": "Indonesia",
- # "cities": [
- # {
- # "name": "Bali"
- # }
- # ]
- # }
- # ],
- # "status": 200,
- # "statusText": "OK"
- # }
- # ```
+ const { data, error } = await supabase
+ .from('cities')
+ .eq('name', 'The Shire') // Incorrect
+ .select('name, country_id')
+ ```
+ - id: chaining-filters
+ name: Chaining
+ description: |
+ Filters can be chained together to produce advanced queries. For example,
+ to query cities with population between 1,000 and 10,000:
+
+ ```ts
+ const { data, error } = await supabase
+ .from('cities')
+ .select('name, country_id')
+ .gte('population', 1000)
+ .lt('population', 10000)
+ ```
+ code: |
+ ```ts
+ const { data, error } = await supabase
+ .from('cities')
+ .select('name, country_id')
+ .gte('population', 1000)
+ .lt('population', 10000)
+ ```
+ - id: conditional-chaining
+ name: Conditional Chaining
+ description: |
+ Filters can be built up one step at a time and then executed. For example:
+
+ ```ts
+ const filterByName = null
+ const filterPopLow = 1000
+ const filterPopHigh = 10000
+
+ let query = supabase
+ .from('cities')
+ .select('name, country_id')
+
+ if (filterByName) { query = query.eq('name', filterByName) }
+ if (filterPopLow) { query = query.gte('population', filterPopLow) }
+ if (filterPopHigh) { query = query.lt('population', filterPopHigh) }
+
+ const { data, error } = await query
+ ```
+ code: |
+ ```ts
+ const filterByName = null
+ const filterPopLow = 1000
+ const filterPopHigh = 10000
+
+ let query = supabase
+ .from('cities')
+ .select('name, country_id')
+
+ if (filterByName) { query = query.eq('name', filterByName) }
+ if (filterPopLow) { query = query.gte('population', filterPopLow) }
+ if (filterPopHigh) { query = query.lt('population', filterPopHigh) }
+
+ const { data, error } = await query
+ ```
+ - id: filter-by-value-within-json-column
+ name: Filter by values within a JSON column
+ code: |
+ ```ts
+ const { data, error } = await supabase
+ .from('users')
+ .select()
+ .eq('address->postcode', 90210)
+ ```
+ data:
+ sql: |
+ ```sql
+ create table
+ users (
+ id int8 primary key,
+ name text,
+ address jsonb
+ );
- # </TabPanel>
- # </Tabs>
+ insert into
+ users (id, name, address)
+ values
+ (1, 'Michael', '{ "postcode": 90210 }'),
+ (2, 'Jane', null);
+ ```
+ response: |
+ ```json
+ {
+ "data": [
+ {
+ "id": 1,
+ "name": "Michael",
+ "address": {
+ "postcode": 90210
+ }
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
+ description: |
+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">
+ <TabPanel id="schema" label="Schema">
+
+ ```sql
+ create table
+ users (
+ id int8 primary key,
+ name text,
+ address jsonb
+ );
+
+ insert into
+ users (id, name, address)
+ values
+ (1, 'Michael', '{ "postcode": 90210 }'),
+ (2, 'Jane', null);
+ ```
+
+ </TabPanel>
+ <TabPanel id="js" label="JavaScript">
+
+ ```ts
+ const { data, error } = await supabase
+ .from('users')
+ .select()
+ .eq('address->postcode', 90210)
+ ```
+
+ </TabPanel>
+ <TabPanel id="result" label="Result">
+
+ ```json
+ {
+ "data": [
+ {
+ "id": 1,
+ "name": "Michael",
+ "address": {
+ "postcode": 90210
+ }
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
+
+ </TabPanel>
+ </Tabs>
+ - id: filter-foreign-tables
+ name: Filter Foreign Tables
+ code: |
+ ```ts
+ const { data, error } = await supabase
+ .from('countries')
+ .select(`
+ name,
+ cities!inner (
+ name
+ )
+ `)
+ .eq('cities.name', 'Bali')
+ ```
+ data:
+ sql: |
+ ```sql
+ create table
+ countries (id int8 primary key, name text);
+ create table
+ cities (
+ id int8 primary key,
+ country_id int8 not null references countries,
+ name text
+ );
+
+ insert into
+ countries (id, name)
+ values
+ (1, 'Germany'),
+ (2, 'Indonesia');
+ insert into
+ cities (id, country_id, name)
+ values
+ (1, 2, 'Bali'),
+ (2, 1, 'Munich');
+ ```
+ response: |
+ ```json
+ {
+ "data": [
+ {
+ "name": "Indonesia",
+ "cities": [
+ {
+ "name": "Bali"
+ }
+ ]
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
+ description: |
+ You can filter on foreign tables in your `select()` query using dot
+ notation:
+
+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">
+ <TabPanel id="schema" label="Schema">
+
+ ```sql
+ create table
+ countries (id int8 primary key, name text);
+ create table
+ cities (
+ id int8 primary key,
+ country_id int8 not null references countries,
+ name text
+ );
+
+ insert into
+ countries (id, name)
+ values
+ (1, 'Germany'),
+ (2, 'Indonesia');
+ insert into
+ cities (id, country_id, name)
+ values
+ (1, 2, 'Bali'),
+ (2, 1, 'Munich');
+ ```
+
+ </TabPanel>
+ <TabPanel id="js" label="JavaScript">
+
+ ```ts
+ const { data, error } = await supabase
+ .from('countries')
+ .select(`
+ name,
+ cities!inner (
+ name
+ )
+ `)
+ .eq('cities.name', 'Bali')
+ ```
+
+ </TabPanel>
+ <TabPanel id="result" label="Result">
+
+ ```json
+ {
+ "data": [
+ {
+ "name": "Indonesia",
+ "cities": [
+ {
+ "name": "Bali"
+ }
+ ]
+ }
+ ],
+ "status": 200,
+ "statusText": "OK"
+ }
+ ```
+
+ </TabPanel>
+ </Tabs>
######## TODO CHECK FILTER YAML ERRORS ########
- id: eq
title: eq()
@@ -6517,7 +6518,7 @@ functions:
</Tabs>
hideCodeBlock: true
isSpotlight: true
- - id: maybeSingle
+ - id: maybe-single
title: maybeSingle()
$ref: '@supabase/postgrest-js.PostgrestTransformBuilder.maybeSingle'
examples: