mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Add new temp client lib spec files, update generator
This commit is contained in:
1 parent
9528e8a7f3
commit
0f131da66e
11 files changed
+2228
-1522
No files matched your search
@@ -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)
|
||||
|
||||
@@ -28,6 +28,7 @@ export namespace OpenRef {
|
||||
title?: string
|
||||
description?: string
|
||||
notes?: string
|
||||
id: string
|
||||
// $ref?: string // reference to a TSDoc node
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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*',
|
||||
}
|
||||
@@ -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'
|
||||
+318
-143
@@ -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: get-user
|
||||
title: getUser()
|
||||
product: 'Auth'
|
||||
|
||||
- id: supabase-secrets-unset
|
||||
title: supabase secrets unset
|
||||
product: 'secrets'
|
||||
- id: update-user
|
||||
title: updateUser()
|
||||
product: 'Auth'
|
||||
|
||||
- id: supabase-secrets-set
|
||||
title: supabase secrets set
|
||||
product: 'secrets'
|
||||
- id: set-session
|
||||
title: setSession()
|
||||
product: 'Auth'
|
||||
|
||||
- id: supabase-secrets-list
|
||||
title: supabase secrets list
|
||||
product: 'secrets'
|
||||
- id: refresh-session
|
||||
title: refreshSession()
|
||||
product: 'Auth'
|
||||
|
||||
- id: supabase-projects
|
||||
title: supabase projects
|
||||
product: 'projects'
|
||||
- id: on-auth-state-change
|
||||
title: onAuthStateChange()
|
||||
product: 'Auth'
|
||||
|
||||
- id: supabase-projects-list
|
||||
title: supabase projects list
|
||||
product: 'projects'
|
||||
- id: admin-api
|
||||
title: Overview
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-projects-create
|
||||
title: supabase projects create
|
||||
product: 'projects'
|
||||
- id: get-user-by-id
|
||||
title: getUserById()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-orgs
|
||||
title: supabase orgs
|
||||
product: 'organizations'
|
||||
- id: list-users
|
||||
title: listUsers()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-orgs-list
|
||||
title: supabase orgs list
|
||||
product: 'organizations'
|
||||
- id: create-user
|
||||
title: createUser()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-migration
|
||||
title: supabase migration
|
||||
product: 'migration'
|
||||
- id: delete-user
|
||||
title: deleteUser()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-migration-new
|
||||
title: supabase migration new
|
||||
product: 'migration'
|
||||
- id: invite-user-by-email
|
||||
title: inviteUserByEmail()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-migration-list
|
||||
title: supabase migration list
|
||||
product: 'migration'
|
||||
- id: auth-reset-password-for-email
|
||||
title: resetPasswordForEmail()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-functions
|
||||
title: supabase functions
|
||||
product: 'functions'
|
||||
- id: generate-link
|
||||
title: generateLink()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-functions-serve
|
||||
title: supabase functions serve
|
||||
product: 'functions'
|
||||
- id: update-user-by-id
|
||||
title: updateUserById()
|
||||
product: 'Auth-admin'
|
||||
|
||||
- id: supabase-functions-new
|
||||
title: supabase functions new
|
||||
product: 'functions'
|
||||
- id: select
|
||||
title: 'Fetch data: select()'
|
||||
product: 'Database'
|
||||
|
||||
- id: supabase-functions-deploy
|
||||
title: supabase functions deploy
|
||||
product: 'functions'
|
||||
- id: insert
|
||||
title: 'Create data: insert()'
|
||||
product: 'Database'
|
||||
|
||||
- id: supabase-functions-delete
|
||||
title: supabase functions delete
|
||||
product: 'functions'
|
||||
- id: update
|
||||
title: 'Modify data: update()'
|
||||
product: 'Database'
|
||||
|
||||
- id: supabase-domains
|
||||
title: supabase domains
|
||||
product: 'domains'
|
||||
- id: upsert
|
||||
title: 'Upsert data: upsert()'
|
||||
product: 'Database'
|
||||
|
||||
- id: supabase-domains-reverify
|
||||
title: supabase domains reverify
|
||||
product: 'domains'
|
||||
- id: delete
|
||||
title: 'Delete data: delete()'
|
||||
product: 'Database'
|
||||
|
||||
- id: supabase-domains-get
|
||||
title: supabase domains get
|
||||
product: 'domains'
|
||||
- id: rpc
|
||||
title: 'Postgres functions: rpc()'
|
||||
product: 'Database'
|
||||
|
||||
- id: supabase-domains-delete
|
||||
title: supabase domains delete
|
||||
product: 'domains'
|
||||
- id: eq
|
||||
title: eq()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-domains-create
|
||||
title: supabase domains create
|
||||
product: 'domains'
|
||||
- id: neq
|
||||
title: neq()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-domains-activate
|
||||
title: supabase domains activate
|
||||
product: 'domains'
|
||||
- id: gt
|
||||
title: gt()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db
|
||||
title: supabase db
|
||||
product: 'database'
|
||||
- id: gte
|
||||
title: gte()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-reset
|
||||
title: supabase db reset
|
||||
product: 'database'
|
||||
- id: lt
|
||||
title: lt()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-remote
|
||||
title: supabase db remote
|
||||
product: 'database'
|
||||
- id: lte
|
||||
title: lte()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-remote-commit
|
||||
title: supabase db remote commit
|
||||
product: 'database'
|
||||
- id: like
|
||||
title: like()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-remote-changes
|
||||
title: supabase db remote changes
|
||||
product: 'database'
|
||||
- id: ilike
|
||||
title: ilike()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-push
|
||||
title: supabase db push
|
||||
product: 'database'
|
||||
- id: is
|
||||
title: is()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-lint
|
||||
title: supabase db lint
|
||||
product: 'database'
|
||||
- id: in
|
||||
title: in()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-db-diff
|
||||
title: supabase db diff
|
||||
product: 'database'
|
||||
- id: contains
|
||||
title: contains()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-completion
|
||||
title: supabase completion
|
||||
product: 'completion'
|
||||
- id: contained-by
|
||||
title: containedBy()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-completion-zsh
|
||||
title: supabase completion zsh
|
||||
product: 'completion'
|
||||
- id: range-gt
|
||||
title: rangeGt()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-completion-powershell
|
||||
title: supabase completion powershell
|
||||
product: 'completion'
|
||||
- id: range-gte
|
||||
title: rangeGte()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-completion-fish
|
||||
title: supabase completion fish
|
||||
product: 'completion'
|
||||
- id: range-lt
|
||||
title: rangeLt()
|
||||
product: 'Database'
|
||||
parent: 'Filters'
|
||||
|
||||
- id: supabase-completion-bash
|
||||
title: supabase completion bash
|
||||
product: 'completion'
|
||||
- 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'
|
||||
@@ -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'
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -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:
|
||||
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 { 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
|
||||
```ts
|
||||
const filterByName = null
|
||||
const filterPopLow = 1000
|
||||
const filterPopHigh = 10000
|
||||
|
||||
# let query = supabase
|
||||
# .from('cities')
|
||||
# .select('name, country_id')
|
||||
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) }
|
||||
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
|
||||
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')
|
||||
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) }
|
||||
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
|
||||
# );
|
||||
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">
|
||||
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
|
||||
# );
|
||||
```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);
|
||||
# ```
|
||||
insert into
|
||||
users (id, name, address)
|
||||
values
|
||||
(1, 'Michael', '{ "postcode": 90210 }'),
|
||||
(2, 'Jane', null);
|
||||
```
|
||||
|
||||
# </TabPanel>
|
||||
# <TabPanel id="js" label="JavaScript">
|
||||
</TabPanel>
|
||||
<TabPanel id="js" label="JavaScript">
|
||||
|
||||
# ```ts
|
||||
# const { data, error } = await supabase
|
||||
# .from('users')
|
||||
# .select()
|
||||
# .eq('address->postcode', 90210)
|
||||
# ```
|
||||
```ts
|
||||
const { data, error } = await supabase
|
||||
.from('users')
|
||||
.select()
|
||||
.eq('address->postcode', 90210)
|
||||
```
|
||||
|
||||
# </TabPanel>
|
||||
# <TabPanel id="result" label="Result">
|
||||
</TabPanel>
|
||||
<TabPanel id="result" label="Result">
|
||||
|
||||
# ```json
|
||||
# {
|
||||
# "data": [
|
||||
# {
|
||||
# "id": 1,
|
||||
# "name": "Michael",
|
||||
# "address": {
|
||||
# "postcode": 90210
|
||||
# }
|
||||
# }
|
||||
# ],
|
||||
# "status": 200,
|
||||
# "statusText": "OK"
|
||||
# }
|
||||
# ```
|
||||
```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
|
||||
# );
|
||||
</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:
|
||||
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">
|
||||
<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
|
||||
# );
|
||||
```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');
|
||||
# ```
|
||||
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">
|
||||
</TabPanel>
|
||||
<TabPanel id="js" label="JavaScript">
|
||||
|
||||
# ```ts
|
||||
# const { data, error } = await supabase
|
||||
# .from('countries')
|
||||
# .select(`
|
||||
# name,
|
||||
# cities!inner (
|
||||
# name
|
||||
# )
|
||||
# `)
|
||||
# .eq('cities.name', 'Bali')
|
||||
# ```
|
||||
```ts
|
||||
const { data, error } = await supabase
|
||||
.from('countries')
|
||||
.select(`
|
||||
name,
|
||||
cities!inner (
|
||||
name
|
||||
)
|
||||
`)
|
||||
.eq('cities.name', 'Bali')
|
||||
```
|
||||
|
||||
# </TabPanel>
|
||||
# <TabPanel id="result" label="Result">
|
||||
</TabPanel>
|
||||
<TabPanel id="result" label="Result">
|
||||
|
||||
# ```json
|
||||
# {
|
||||
# "data": [
|
||||
# {
|
||||
# "name": "Indonesia",
|
||||
# "cities": [
|
||||
# {
|
||||
# "name": "Bali"
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# ],
|
||||
# "status": 200,
|
||||
# "statusText": "OK"
|
||||
# }
|
||||
# ```
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"name": "Indonesia",
|
||||
"cities": [
|
||||
{
|
||||
"name": "Bali"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"statusText": "OK"
|
||||
}
|
||||
```
|
||||
|
||||
# </TabPanel>
|
||||
# </Tabs>
|
||||
</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:
|
||||
|
||||
Reference in new issue
Block a user