mirror of
https://github.com/supabase/supabase.git
synced 2026-07-01 06:14:19 +08:00
4
apps/temp-docs/.gitignore
vendored
4
apps/temp-docs/.gitignore
vendored
@@ -18,4 +18,6 @@ npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
**/*/generated
|
||||
**/*/generated/**/*
|
||||
!**/*/generated/.gitkeep
|
||||
!**/*/generated/**/.gitkeep
|
||||
@@ -1,13 +1,30 @@
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { IconMenu, IconSearch, Input, IconCommand, Button, IconMoon, IconSun } from 'ui'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useState, useEffect, FC } from 'react'
|
||||
import { IconMenu, IconSearch, Input, IconCommand, Button, IconMoon, IconSun, Listbox } from 'ui'
|
||||
import { useTheme } from '../Providers'
|
||||
import { REFERENCES } from './Navigation.constants'
|
||||
|
||||
const NavBar = ({ currentPage }: { currentPage: string }) => {
|
||||
interface Props {
|
||||
currentPage: string
|
||||
}
|
||||
|
||||
const NavBar: FC<Props> = ({ currentPage }) => {
|
||||
const { isDarkMode, toggleTheme } = useTheme()
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
const { asPath, push } = useRouter()
|
||||
const pathSegments = asPath.split('/')
|
||||
|
||||
const library = pathSegments.length >= 3 ? pathSegments[2] : undefined
|
||||
const libraryMeta = REFERENCES?.[library] ?? undefined
|
||||
const versions = libraryMeta?.versions ?? []
|
||||
|
||||
const version = versions.includes(pathSegments[pathSegments.indexOf(library) + 1])
|
||||
? pathSegments[pathSegments.indexOf(library) + 1]
|
||||
: versions[0]
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true)
|
||||
}, [isDarkMode])
|
||||
@@ -25,6 +42,16 @@ const NavBar = ({ currentPage }: { currentPage: string }) => {
|
||||
document.documentElement.className = key === 'true' ? 'dark' : ''
|
||||
}
|
||||
|
||||
const onSelectVersion = (version: string) => {
|
||||
// [Joshen] Ideally we use <Link> but this works for now
|
||||
if (!library) return
|
||||
if (version === versions[0]) {
|
||||
push(`/reference/${library}`)
|
||||
} else {
|
||||
push(`/reference/${library}/${version}`)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<nav
|
||||
className={[
|
||||
@@ -67,6 +94,22 @@ const NavBar = ({ currentPage }: { currentPage: string }) => {
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
{versions.length > 0 && (
|
||||
<div className="ml-8">
|
||||
<Listbox
|
||||
size="small"
|
||||
defaultValue={version}
|
||||
style={{ width: '70px' }}
|
||||
onChange={onSelectVersion}
|
||||
>
|
||||
{versions.map((version) => (
|
||||
<Listbox.Option key={version} label={version} value={version}>
|
||||
{version}
|
||||
</Listbox.Option>
|
||||
))}
|
||||
</Listbox>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="hidden items-center md:flex">
|
||||
|
||||
@@ -7,19 +7,33 @@ import SupabaseAPINav from 'data/nav/supabase-api'
|
||||
import AuthServerNav from 'data/nav/auth-server'
|
||||
import StorageServerNav from 'data/nav/storage-server'
|
||||
|
||||
export interface NavMenu {
|
||||
[key: string]: NavMenuGroup[]
|
||||
}
|
||||
import { NavMenu, References } from './Navigation.types'
|
||||
|
||||
export interface NavMenuGroup {
|
||||
label: string
|
||||
items: NavMenuSection[]
|
||||
}
|
||||
|
||||
export interface NavMenuSection {
|
||||
name: string
|
||||
url?: string
|
||||
items: NavMenuSection[]
|
||||
export const REFERENCES: References = {
|
||||
javascript: {
|
||||
name: 'supabase-js',
|
||||
library: 'supabase-js',
|
||||
versions: ['v2', 'v1'],
|
||||
icon: '/docs/img/libraries/javascript-icon.svg',
|
||||
},
|
||||
dart: {
|
||||
name: 'Flutter',
|
||||
library: 'supabase-dart',
|
||||
versions: ['v1', 'v0'],
|
||||
icon: '/docs/img/libraries/dart-icon.svg',
|
||||
},
|
||||
cli: {
|
||||
name: 'CLI',
|
||||
library: undefined,
|
||||
versions: [],
|
||||
icon: '/docs/img/libraries/cli-icon.svg',
|
||||
},
|
||||
api: {
|
||||
name: 'API',
|
||||
library: undefined,
|
||||
versions: [],
|
||||
icon: '/docs/img/libraries/api-icon.svg',
|
||||
},
|
||||
}
|
||||
|
||||
export const menuItems: NavMenu = {
|
||||
@@ -291,7 +305,7 @@ export const menuItems: NavMenu = {
|
||||
{ name: 'Supabase Javascript Library', url: '/reference/javascript', items: [] },
|
||||
{ name: 'Supabase Flutter Library', url: '/reference/dart', items: [] },
|
||||
{ name: 'Supabase CLI', url: '/reference/cli', items: [] },
|
||||
{ name: 'Supabase API', url: '/reference/api', items: [] },
|
||||
{ name: 'Management API', url: '/reference/api', items: [] },
|
||||
],
|
||||
},
|
||||
{
|
||||
23
apps/temp-docs/components/Navigation/Navigation.types.ts
Normal file
23
apps/temp-docs/components/Navigation/Navigation.types.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export interface NavMenu {
|
||||
[key: string]: NavMenuGroup[]
|
||||
}
|
||||
|
||||
export interface NavMenuGroup {
|
||||
label: string
|
||||
items: NavMenuSection[]
|
||||
}
|
||||
|
||||
export interface NavMenuSection {
|
||||
name: string
|
||||
url?: string
|
||||
items: NavMenuSection[]
|
||||
}
|
||||
|
||||
export interface References {
|
||||
[key: string]: {
|
||||
name: string
|
||||
library?: string
|
||||
versions: string[]
|
||||
icon: string
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,8 @@ import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import { useRouter } from 'next/router'
|
||||
import { IconChevronRight, IconArrowLeft } from '~/../../packages/ui'
|
||||
import { NavMenuGroup, NavMenuSection } from './Nav.constants'
|
||||
import { REFERENCES } from './Navigation.constants'
|
||||
import { NavMenuGroup, NavMenuSection } from './Navigation.types'
|
||||
import * as Accordion from '@radix-ui/react-accordion'
|
||||
|
||||
const SideBar = ({ menuItems = [] }: { menuItems: any }) => {
|
||||
@@ -10,13 +11,7 @@ const SideBar = ({ menuItems = [] }: { menuItems: any }) => {
|
||||
const pathSegments = asPath.split('/')
|
||||
|
||||
const isInReferencePages = pathSegments.includes('reference') && pathSegments.length >= 3
|
||||
const references = {
|
||||
javascript: { name: 'supabase-js', icon: '/docs/img/libraries/javascript-icon.svg' },
|
||||
dart: { name: 'Flutter', icon: '/docs/img/libraries/dart-icon.svg' },
|
||||
cli: { name: 'CLI', icon: '/docs/img/libraries/cli-icon.svg' },
|
||||
api: { name: 'API', icon: '/docs/img/libraries/api-icon.svg' },
|
||||
}
|
||||
const referenceMeta = pathSegments.length >= 3 ? references[pathSegments[2]] : undefined
|
||||
const referenceMeta = pathSegments.length >= 3 ? REFERENCES[pathSegments[2]] : undefined
|
||||
|
||||
const currentSection: NavMenuGroup = menuItems.find((group) => {
|
||||
const foundItem = group.items.find((section) => {
|
||||
@@ -45,8 +40,6 @@ const SideBar = ({ menuItems = [] }: { menuItems: any }) => {
|
||||
})
|
||||
: undefined
|
||||
|
||||
console.log({ currentSection, currentSubSection })
|
||||
|
||||
return (
|
||||
<div
|
||||
className="dark:bg-scale-200 dark:border-scale-400 sidebar-width sticky top-0
|
||||
@@ -80,6 +73,7 @@ const SideBar = ({ menuItems = [] }: { menuItems: any }) => {
|
||||
)}
|
||||
{menuItems.length === 1 ? (
|
||||
<div className="my-2">
|
||||
<h4 className="text-scale-1200 pt-2 pb-3">{menuItems[0].label}</h4>
|
||||
{menuItems[0].items.map((item) => (
|
||||
<Link href={item.url}>
|
||||
<a>
|
||||
|
||||
29
apps/temp-docs/data/nav/README.md
Normal file
29
apps/temp-docs/data/nav/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# [WIP] Adding navigation for a new section
|
||||
|
||||
[Note] This isn't the best way for versioning in my opinion, but this is the current way to do it while we're migrating to Next.js
|
||||
|
||||
This folder holds the structure for the side navigation menu in the reference documentation pages. Each reference section (as well as their individual versions where applicable) have its own set of navigation.
|
||||
|
||||
The following are relevant to adding navigation for a new section:
|
||||
|
||||
- `getPageType()` from `lib/helpers`
|
||||
- `menuItems` and `REFERENCES` from `components/Navigation/Navigation.constants`
|
||||
- `NavMenu` from `components/Navigation/Navigation.types`
|
||||
|
||||
## Adding navigation for a section that doesn't require versioning
|
||||
|
||||
Example for standalone sections are the API and CLI reference pages. You'll just need to add a new file in this folder following the `NavMenu` interface (naming is arbitrary).
|
||||
|
||||
Thereafter, update `getPageType` to be able to get the page type based on the URL path - preferably follow the syntax of `reference/{section_name}`.
|
||||
|
||||
Finally, add the menu to `menuItems` under a new key - the key should be what you added to `getPageType` before.
|
||||
|
||||
## Adding navigation for a section that requires versioning
|
||||
|
||||
This is more applicable for client libraries (e.g supabase-js and supabase-dart). Versions will all sit within their own folder - if the folder doesn't exist yet, just create one. The navigation for each section will then be named as 'v1', 'v2', and so on.
|
||||
|
||||
Then, update `REFERENCES` accordingly.
|
||||
|
||||
Thereafter, update `getPageType` to be able to get the page type based on the URL path - preferably follow the syntax of `reference/{section_name}/{version}`. Typically the latest version available will not have the `/{version}` in it.
|
||||
|
||||
Finally, add the menu to `menuItems` under a new key - the key should be what you added to `getPageType` before.
|
||||
26
apps/temp-docs/data/nonGeneratedReferencePages.ts
Normal file
26
apps/temp-docs/data/nonGeneratedReferencePages.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
const nonGeneratedReferencePages = [
|
||||
'docs/reference/javascript',
|
||||
'docs/reference/javascript/installing',
|
||||
'docs/reference/javascript/release-notes',
|
||||
'docs/reference/javascript/upgrade-guide',
|
||||
'docs/reference/javascript/typescript-support',
|
||||
'docs/reference/javascript/v1',
|
||||
'docs/reference/javascript/v1/installing',
|
||||
'docs/reference/javascript/v1/initializing',
|
||||
'docs/reference/javascript/v1/generating-types',
|
||||
'docs/reference/dart',
|
||||
'docs/reference/dart/installing',
|
||||
'docs/reference/dart/initializing',
|
||||
'docs/reference/dart/upgrade-guide',
|
||||
'docs/reference/dart/v0',
|
||||
'docs/reference/api',
|
||||
'docs/reference/api/release-notes',
|
||||
'docs/reference/cli',
|
||||
'docs/reference/cli/release-notes',
|
||||
'docs/reference/auth',
|
||||
'docs/reference/auth/release-notes',
|
||||
'docs/reference/storage',
|
||||
'docs/reference/storage/release-notes',
|
||||
]
|
||||
|
||||
export default nonGeneratedReferencePages
|
||||
@@ -1,72 +0,0 @@
|
||||
---
|
||||
id: auth-onauthstatechange
|
||||
title: "auth.onAuthStateChange()"
|
||||
slug: auth-onauthstatechange
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Receive a notification every time an auth event happens.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final subscription = supabase.auth.onAuthStateChange((event, session) {
|
||||
print(session?.user?.id);
|
||||
// handle auth state change
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Listen to auth changes
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final subscription = supabase.auth.onAuthStateChange((event, session) {
|
||||
print(session?.user?.id);
|
||||
// handle auth state change
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,66 +0,0 @@
|
||||
---
|
||||
id: auth-session
|
||||
title: "auth.session()"
|
||||
slug: auth-session
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Returns the session data, if there is an active session.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final session = supabase.auth.session();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Get the session data
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final session = supabase.auth.session();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,103 +0,0 @@
|
||||
---
|
||||
id: auth-signin
|
||||
title: 'auth.signIn()'
|
||||
slug: auth-signin
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
import TabsPanel from '@theme/TabsPanel'
|
||||
|
||||
Log in an existing user, or login via a third-party provider.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password');
|
||||
|
||||
final user = res.data?.user;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## 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.
|
||||
- If you are looking to sign users in with OAuth in Flutter apps, go to [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider).
|
||||
|
||||
## Examples
|
||||
|
||||
### Sign in with email.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password');
|
||||
|
||||
final user = res.data?.user;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Sign in with magic link.
|
||||
|
||||
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.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signIn(email: 'example@email.com');
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Get OAuth sign in URL.
|
||||
|
||||
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/auth-signinwithprovider).
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signIn(provider: Provider.github);
|
||||
|
||||
final url = res.data?.url;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,129 +0,0 @@
|
||||
---
|
||||
id: auth-signinwithprovider
|
||||
title: "auth.signInWithProvider()"
|
||||
slug: auth-signinwithprovider
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Signs the user in using third party OAuth providers.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signInWithProvider(Provider.github);
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- `auth.signInWithProvider()` is only available on `supabase_flutter`
|
||||
- It will open the browser to the relevant login page.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Sign in with provider.
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signInWithProvider(Provider.github);
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `redirectTo`
|
||||
|
||||
Specify the redirect link to bring back the user via deeplink.
|
||||
Note that `redirectTo` should be null for Flutter Web.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signInWithProvider(
|
||||
Provider.github,
|
||||
options: AuthOptions(
|
||||
redirectTo: kIsWeb
|
||||
? null
|
||||
: 'io.supabase.flutter://reset-callback/'),
|
||||
);
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With scopes
|
||||
|
||||
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.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
const { user, session, error } = await supabase.auth.signIn({
|
||||
provider: 'github'
|
||||
}, {
|
||||
scopes: 'repo gist notifications'
|
||||
})
|
||||
const oAuthToken = session.provider_token // use to access provider API
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,70 +0,0 @@
|
||||
---
|
||||
id: auth-signout
|
||||
title: "auth.signOut()"
|
||||
slug: auth-signout
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Signs out the current user, if there is a logged in user.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signOut();
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Sign out
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signOut();
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
id: auth-signup
|
||||
title: 'auth.signUp()'
|
||||
slug: auth-signup
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
import TabsPanel from '@theme/TabsPanel'
|
||||
|
||||
Creates a new user.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signUp('example@email.com', 'example-password');
|
||||
|
||||
final user = res.data?.user;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Notes
|
||||
|
||||
- By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
|
||||
- If "Email Confirmations" is turned on, a `user` is returned but `session` will be null
|
||||
- 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
|
||||
|
||||
### Sign up.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.signUp('example@email.com', 'example-password');
|
||||
|
||||
final user = res.data?.user;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Sign up with third-party providers.
|
||||
|
||||
If you are using Flutter, you can sign up with OAuth providers using the [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider) method available on `supabase_flutter`.
|
||||
@@ -1,76 +0,0 @@
|
||||
---
|
||||
id: auth-update
|
||||
title: "auth.update()"
|
||||
slug: auth-update
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Updates user data, if there is a logged in user.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.update(
|
||||
UserAttributes(data: {'hello': 'world'})
|
||||
);
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
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
|
||||
|
||||
### Update a user's metadata.
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.update(
|
||||
UserAttributes(data: {'hello': 'world'})
|
||||
);
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,66 +0,0 @@
|
||||
---
|
||||
id: auth-user
|
||||
title: "auth.user()"
|
||||
slug: auth-user
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Returns the user data, if there is a logged in user.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final user = supabase.auth.user();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Get the logged in user
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final user = supabase.auth.user();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: containedby
|
||||
title: ".containedBy()"
|
||||
slug: containedby
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, main_exports')
|
||||
.containedBy('main_exports', ['cars', 'food', 'machine'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, main_exports')
|
||||
.containedBy('main_exports', ['cars', 'food', 'machine'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.containedBy('main_exports', ['orks', 'surveillance', 'evil'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.containedBy('main_exports', ['cars', 'food', 'machine'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.containedBy('main_exports', ['cars', 'food', 'machine'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: contains
|
||||
title: ".contains()"
|
||||
slug: contains
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, main_exports')
|
||||
.contains('main_exports', ['oil'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, main_exports')
|
||||
.contains('main_exports', ['oil'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.contains('main_exports', ['oil'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.contains('main_exports', ['oil'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.contains('main_exports', ['oil'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,76 +0,0 @@
|
||||
---
|
||||
id: delete
|
||||
title: "Delete data: delete()"
|
||||
slug: delete
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Performs a DELETE on the table.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.match({ 'id': 666 })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
TODO update link to dart
|
||||
- `delete()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Delete records
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.match({ 'id': 666 })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: eq
|
||||
title: ".eq()"
|
||||
slug: eq
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value on the stated `column` exactly matches the specified `value`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.eq('name', 'The shire')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.eq('name', 'The shire')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.eq('name', 'San Francisco')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.eq('name', 'Mordor')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.eq('name', 'San Francisco')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,170 +0,0 @@
|
||||
---
|
||||
id: filter
|
||||
title: ".filter()"
|
||||
slug: filter
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose `column` satisfies the filter.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.filter('name', 'in', '("Paris","Tokyo")')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter values, so it should only be used as an escape hatch in case other filters don't work.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.filter('name', 'in', '("Paris","Tokyo")')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.filter('name', 'in', '("Paris","Tokyo")')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.filter('name', 'in', '("Paris","Tokyo")')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.filter('name', 'in', '("Paris","Tokyo")')
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Filter embedded resources
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, countries ( name )')
|
||||
.filter('countries.name', 'in', '("France","Japan")')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,66 +0,0 @@
|
||||
---
|
||||
id: getsubscriptions
|
||||
title: "getSubscriptions()"
|
||||
slug: getsubscriptions
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Returns an array of all your subscriptions.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final subscriptions = supabase.getSubscriptions();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Get all subscriptions
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final subscriptions = supabase.getSubscriptions();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: gt
|
||||
title: ".gt()"
|
||||
slug: gt
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value on the stated `column` is greater than the specified `value`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.gt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.gt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.gt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.gt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.gt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: gte
|
||||
title: ".gte()"
|
||||
slug: gte
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.gte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.gte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.gte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.gte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.gte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: ilike
|
||||
title: ".ilike()"
|
||||
slug: ilike
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive).
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.ilike('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.ilike('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.ilike('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.ilike('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.ilike('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,148 +0,0 @@
|
||||
---
|
||||
id: in_
|
||||
title: ".in_()"
|
||||
slug: in_
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
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.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.in_('name', ['Rio de Janeiro', 'San Francisco'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.in_('name', ['Rio de Janeiro', 'San Francisco'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.in_('name', ['Rio de Janeiro', 'San Francisco'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.in_('name', ['Rio de Janeiro', 'San Francisco'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.in_('name', ['Rio de Janeiro', 'San Francisco'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
id: index
|
||||
title: "Getting started"
|
||||
slug: getting-started
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
Supabase Dart.
|
||||
@@ -1,84 +0,0 @@
|
||||
---
|
||||
id: initializing
|
||||
title: "Initializing"
|
||||
slug: initializing
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
## Dart
|
||||
You can initialize a new Supabase client using the `SupabaseClient()` method.
|
||||
|
||||
The Supabase client is your entrypoint to the rest of the Supabase functionality
|
||||
and is the easiest way to interact with everything we offer within the Supabase ecosystem.
|
||||
|
||||
|
||||
## Flutter
|
||||
|
||||
For `supabase_flutter`, you will be using the static `initialize()` method on `Supabase` class.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Dart SupabaseClient()
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final supabase = SupabaseClient('https://xyzcompany.supabase.co', 'public-anon-key');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Flutter initialize()
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart title="main.dart"
|
||||
Future<void> main() async {
|
||||
await Supabase.initialize(url: 'https://xyzcompany.supabase.co', anonKey: 'public-anon-key');
|
||||
runApp(MyApp());
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,102 +0,0 @@
|
||||
---
|
||||
id: insert
|
||||
title: "Create data: insert()"
|
||||
slug: insert
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Performs an INSERT into the table.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.insert([
|
||||
{'name': 'The Shire', 'country_id': 554}
|
||||
]).execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## 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.
|
||||
If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create a record
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.insert([
|
||||
{'name': 'The Shire', 'country_id': 554}
|
||||
]).execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Bulk create
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.insert([
|
||||
{'name': 'The Shire', 'country_id': 554},
|
||||
{'name': 'Rohan', 'country_id': 555},
|
||||
]).execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,32 +0,0 @@
|
||||
---
|
||||
id: installing
|
||||
title: "Installing"
|
||||
slug: installing
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
## Dart
|
||||
|
||||
Dart libraries are built and supported by the community.
|
||||
|
||||
```bash
|
||||
dart pub add supabase
|
||||
```
|
||||
|
||||
Find the source code on [GitHub](https://github.com/supabase/supabase-dart).
|
||||
|
||||
## Flutter
|
||||
|
||||
For Flutter project, you can use [supabase_flutter](https://github.com/supabase/supabase-flutter).
|
||||
|
||||
```bash
|
||||
flutter pub add supabase_flutter
|
||||
```
|
||||
|
||||
`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`.
|
||||
|
||||
For the most part `supabase_flutter` shares the same API as `supabase` with few exceptions such as initialization or OAuth sign in.
|
||||
@@ -1,148 +0,0 @@
|
||||
---
|
||||
id: is_
|
||||
title: ".is_()"
|
||||
slug: is_
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
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.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.is_('name', null)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.is_('name', null)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.is_('name', null)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.is_('name', null)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.is_('name', null)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,191 +0,0 @@
|
||||
---
|
||||
id: like
|
||||
title: ".like()"
|
||||
slug: like
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive).
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.like('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
<ul className="method-list-group">
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
column
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>object</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The column to filter on.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
pattern
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The pattern to filter with.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.like('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.like('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.like('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.like('name', '%la%')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,99 +0,0 @@
|
||||
---
|
||||
id: limit
|
||||
title: "limit()"
|
||||
slug: limit
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Limits the result with the specified count.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.limit(1)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.limit(1)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With embedded resources
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, cities(name)')
|
||||
.eq('name', 'United States')
|
||||
.limit(1, foreignTable: 'cities' )
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: lt
|
||||
title: ".lt()"
|
||||
slug: lt
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value on the stated `column` is less than the specified `value`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.lt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.lt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.lt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.lt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.lt('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,191 +0,0 @@
|
||||
---
|
||||
id: lte
|
||||
title: ".lte()"
|
||||
slug: lte
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value on the stated `column` is less than or equal to the specified `value`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.lte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
<ul className="method-list-group">
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
column
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>object</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The column to filter on.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
value
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>object</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The value to filter with.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.lte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.lte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.lte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.lte('country_id', 250)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: match
|
||||
title: ".match()"
|
||||
slug: match
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose columns match the specified `query` object.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.match({'name': 'Beijing', 'country_id': 156})
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.match({'name': 'Beijing', 'country_id': 156})
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.match({'name': 'Beijing', 'country_id': 156})
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.match({'name': 'Beijing', 'country_id': 156})
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.match({'name': 'Beijing', 'country_id': 156})
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: neq
|
||||
title: ".neq()"
|
||||
slug: neq
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose value on the stated `column` doesn't match the specified `value`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.neq('name', 'The shire')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.neq('name', 'The shire')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.neq('name', 'San Francisco')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.neq('name', 'Mordor')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities')
|
||||
.neq('name', 'Lagos')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,146 +0,0 @@
|
||||
---
|
||||
id: not
|
||||
title: ".not()"
|
||||
slug: not
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows which doesn't satisfy the filter.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.not('name', 'eq', 'Paris')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.not('name', 'eq', 'Paris')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.not('name', 'eq', 'Paris')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.delete()
|
||||
.not('name', 'eq', 'Paris')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_cities)
|
||||
.not('name', 'eq', 'Paris')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,98 +0,0 @@
|
||||
---
|
||||
id: or
|
||||
title: ".or()"
|
||||
slug: or
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows satisfying at least one of the filters.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.or('id.eq.20,id.eq.30')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.or('id.eq.20,id.eq.30')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Use `or` with `and`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.or('id.gt.20,and(name.eq.New Zealand,name.eq.France)')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,99 +0,0 @@
|
||||
---
|
||||
id: order
|
||||
title: "order()"
|
||||
slug: order
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Orders the result with the specified column.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.order('id', ascending: false )
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.order('id', ascending: false )
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With embedded resources
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, cities(name)')
|
||||
.eq('name', 'United States')
|
||||
.order('name', foreignTable: 'cities')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: overlaps
|
||||
title: ".overlaps()"
|
||||
slug: overlaps
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, main_exports')
|
||||
.overlaps('main_exports', ['computers', 'minerals'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, main_exports')
|
||||
.overlaps('main_exports', ['computers', 'minerals'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.overlaps('main_exports', ['computers', 'minerals'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.overlaps('main_exports', ['computers', 'minerals'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.overlaps('main_exports', ['computers', 'minerals'])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,74 +0,0 @@
|
||||
---
|
||||
id: range
|
||||
title: "range()"
|
||||
slug: range
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Limits the result to rows within the specified range, inclusive.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.range(0,3)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.range(0,3)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: rangeadjacent
|
||||
title: ".rangeAdjacent()"
|
||||
slug: rangeadjacent
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeAdjacent('population_range_millions', '[70, 185]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeAdjacent('population_range_millions', '[70, 185]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.rangeAdjacent('population_range_millions', '[70, 185]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.rangeAdjacent('population_range_millions', '[70, 185]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.rangeAdjacent('population_range_millions', '[70, 185]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: rangegt
|
||||
title: ".rangeGt()"
|
||||
slug: rangegt
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeGt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeGt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.rangeGt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.rangeGt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.rangeGt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: rangegte
|
||||
title: ".rangeGte()"
|
||||
slug: rangegte
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeGte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeGte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.rangeGte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.rangeGte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.rangeGte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: rangelt
|
||||
title: ".rangeLt()"
|
||||
slug: rangelt
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeLt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeLt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.rangeLt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.rangeLt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.rangeLt('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,145 +0,0 @@
|
||||
---
|
||||
id: rangelte
|
||||
title: ".rangeLte()"
|
||||
slug: rangelte
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeLte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('name, id, population_range_millions')
|
||||
.rangeLte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `update()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.update({ 'name': 'Mordor' })
|
||||
.rangeLte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `delete()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.delete()
|
||||
.rangeLte('population_range_millions', '[150, 250]')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `rpc()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
// Only valid if the Stored Procedure returns a table type.
|
||||
final res = await supabase
|
||||
.rpc('echo_all_countries')
|
||||
.rangeLte('population_range_millions', [150, 250])
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,67 +0,0 @@
|
||||
---
|
||||
id: removesubscription
|
||||
title: "removeSubscription()"
|
||||
slug: removesubscription
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Removes an active subscription and returns the number of open connections.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase.removeSubscription(mySubscription);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
### Remove a subscription
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase.removeSubscription(mySubscription);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,114 +0,0 @@
|
||||
---
|
||||
id: reset-password-email
|
||||
title: "Reset Password (Email)"
|
||||
slug: reset-password-email
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Sends a reset request to an email address.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.api.resetPasswordForEmail('user@example.com');
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
Sends a reset request to an email address.
|
||||
|
||||
When the user clicks the reset link in the email they will be forwarded to:
|
||||
|
||||
`<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery`
|
||||
|
||||
Your app must detect `type=recovery` in the fragment and display a password reset form to the user.
|
||||
|
||||
You should then use the access_token in the url and new password to update the user as follows:
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.api.updateUser(
|
||||
accessToken,
|
||||
UserAttributes(password: 'NEW_PASSWORD'),
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Reset password
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase.auth.api.resetPasswordForEmail('user@example.com');
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Reset password for Flutter
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
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(
|
||||
'user@example.com',
|
||||
options: AuthOptions(redirectTo: kIsWeb
|
||||
? null
|
||||
: 'io.supabase.flutter://reset-callback/'),
|
||||
);
|
||||
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,119 +0,0 @@
|
||||
---
|
||||
id: rpc
|
||||
title: "Stored Procedures: rpc()"
|
||||
slug: rpc
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
You can call stored procedures as a "Remote Procedure Call".
|
||||
|
||||
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.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.rpc('hello_world')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Call a stored procedure
|
||||
|
||||
This is an example invoking a stored procedure.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.rpc('hello_world')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With Parameters
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.rpc('echo_city', params: { 'name': 'The Shire' })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With count option
|
||||
|
||||
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`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.rpc('hello_world')
|
||||
.execute(count: CountOption.exact);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,272 +0,0 @@
|
||||
---
|
||||
id: select
|
||||
title: "Fetch data: select()"
|
||||
slug: select
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Performs vertical filtering with SELECT.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select()
|
||||
.execute();
|
||||
|
||||
final data = res.data;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data.
|
||||
- `select()` can be combined with [Modifiers](/docs/reference/dart/using-modifiers)
|
||||
- `select()` can be combined with [Filters](/docs/reference/dart/using-filters)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Getting your data
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select()
|
||||
.execute();
|
||||
|
||||
final data = res.data;
|
||||
final error = res.error;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Selecting specific columns
|
||||
|
||||
You can select specific fields from your tables.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Query foreign tables
|
||||
|
||||
If your database has relationships, you can query related tables too.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('countries')
|
||||
.select('''
|
||||
name,
|
||||
cities (
|
||||
name
|
||||
)
|
||||
''')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Query the same foreign table multiple times
|
||||
|
||||
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:
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('products')
|
||||
.select('''
|
||||
id,
|
||||
supplier:supplier_id ( name ),
|
||||
purchaser:purchaser_id ( name )
|
||||
''')
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Filtering with inner joins
|
||||
|
||||
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":
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
|
||||
```
|
||||
Not yet implemented
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Querying with count option
|
||||
|
||||
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).
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name')
|
||||
.execute(count: CountOption.exact);
|
||||
|
||||
final count = res.count;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Querying JSON data
|
||||
|
||||
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.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('users')
|
||||
.select('''
|
||||
id, name,
|
||||
address->street
|
||||
''')
|
||||
.eq('address->postcode', 90210)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Return data as CSV
|
||||
|
||||
By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('users')
|
||||
.select()
|
||||
.csv()
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,74 +0,0 @@
|
||||
---
|
||||
id: single
|
||||
title: "single()"
|
||||
slug: single
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.single()
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### With `select()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.single()
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
id: storage-createbucket
|
||||
title: "createBucket()"
|
||||
slug: storage-createbucket
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Creates a new Storage bucket
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.createBucket('avatars');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `insert`
|
||||
- `objects` permissions: none
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.createBucket('avatars');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
id: storage-deletebucket
|
||||
title: "deleteBucket()"
|
||||
slug: storage-deletebucket
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.deleteBucket('avatars');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `select` and `delete`
|
||||
- `objects` permissions: none
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Delete bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.deleteBucket('avatars');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
id: storage-emptybucket
|
||||
title: "emptyBucket()"
|
||||
slug: storage-emptybucket
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Removes all objects inside a single bucket.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.emptyBucket('avatars');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `select`
|
||||
- `objects` permissions: `select` and `delete`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Empty bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.emptyBucket('avatars');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,79 +0,0 @@
|
||||
---
|
||||
id: storage-from-createsignedurl
|
||||
title: "from.createSignedUrl()"
|
||||
slug: storage-from-createsignedurl
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.createSignedUrl('avatar1.png', 60);
|
||||
|
||||
final signedURL = res.data;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `select`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create Signed URL
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.createSignedUrl('avatar1.png', 60);
|
||||
|
||||
final signedURL = res.data;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,75 +0,0 @@
|
||||
---
|
||||
id: storage-from-download
|
||||
title: "from.download()"
|
||||
slug: storage-from-download
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Downloads a file.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.download('avatar1.png');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `select`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Download file
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.download('avatar1.png');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
id: storage-from-getpublicurl
|
||||
title: 'from.getPublicUrl()'
|
||||
slug: storage-from-getpublicurl
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
import TabsPanel from '@theme/TabsPanel'
|
||||
|
||||
Retrieve URLs for assets in public buckets
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = supabase
|
||||
.storage
|
||||
.from('public-bucket')
|
||||
.getPublicUrl('avatar1.png');
|
||||
|
||||
final publicURL = res.data;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## 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
|
||||
- `objects` permissions: none
|
||||
|
||||
## Examples
|
||||
|
||||
### Returns the URL for an asset in a public bucket
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = supabase
|
||||
.storage
|
||||
.from('public-bucket')
|
||||
.getPublicUrl('avatar1.png');
|
||||
|
||||
final publicURL = res.data;
|
||||
```
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,75 +0,0 @@
|
||||
---
|
||||
id: storage-from-list
|
||||
title: "from.list()"
|
||||
slug: storage-from-list
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Lists all the files within a bucket.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.list();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `select`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### List files in a bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.list();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,75 +0,0 @@
|
||||
---
|
||||
id: storage-from-move
|
||||
title: "from.move()"
|
||||
slug: storage-from-move
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Moves an existing file, optionally renaming it at the same time.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.move('public/avatar1.png', 'private/avatar2.png');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `update` and `select`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Move file
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.move('public/avatar1.png', 'private/avatar2.png');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,75 +0,0 @@
|
||||
---
|
||||
id: storage-from-remove
|
||||
title: "from.remove()"
|
||||
slug: storage-from-remove
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Deletes files within the same bucket
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.remove(['avatar1.png']);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `delete` and `select`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Delete file
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.remove(['avatar1.png']);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,83 +0,0 @@
|
||||
---
|
||||
id: storage-from-update
|
||||
title: "from.update()"
|
||||
slug: storage-from-update
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Replaces an existing file at the specified path with a new one.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final avatarFile = File('path/to/file');
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.update('public/avatar1.png', avatarFile, fileOptions: FileOptions(
|
||||
cacheControl: '3600',
|
||||
upsert: false
|
||||
));
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `update` and `select`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Update file
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final avatarFile = File('path/to/file');
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.update('public/avatar1.png', avatarFile, fileOptions: FileOptions(
|
||||
cacheControl: '3600',
|
||||
upsert: false
|
||||
));
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,152 +0,0 @@
|
||||
---
|
||||
id: storage-from-upload
|
||||
title: "from.upload()"
|
||||
slug: storage-from-upload
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Uploads a file to an existing bucket.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final avatarFile = File('path/to/file');
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.upload('public/avatar1.png', avatarFile, fileOptions: FileOptions(
|
||||
cacheControl: '3600',
|
||||
upsert: false
|
||||
));
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
<ul className="method-list-group">
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
path
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
fileBody
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>ArrayBuffer</code> | <code>ArrayBufferView</code> | <code>Blob</code> | <code>Buffer</code> | <code>File</code> | <code>FormData</code> | <code>ReadableStream</code> | <code>ReadableStream</code> | <code>URLSearchParams</code> | <code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The body of the file to be stored in the bucket.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
fileOptions
|
||||
</span>
|
||||
<span className="method-list-item-label-badge false">
|
||||
optional
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>FileOptions</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
HTTP headers.
|
||||
`cacheControl`: string, the `Cache-Control: max-age=<seconds>` seconds value.
|
||||
`contentType`: string, the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`.
|
||||
`upsert`: boolean, whether to perform an upsert.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: none
|
||||
- `objects` permissions: `insert`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Upload file
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final avatarFile = File('path/to/file');
|
||||
final res = await supabase
|
||||
.storage
|
||||
.from('avatars')
|
||||
.upload('public/avatar1.png', avatarFile, fileOptions: FileOptions(
|
||||
cacheControl: '3600',
|
||||
upsert: false
|
||||
));
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,97 +0,0 @@
|
||||
---
|
||||
id: storage-getbucket
|
||||
title: "getBucket()"
|
||||
slug: storage-getbucket
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Retrieves the details of an existing Storage bucket.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.getBucket('avatars')
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
<ul className="method-list-group">
|
||||
|
||||
<li className="method-list-item">
|
||||
<h4 className="method-list-item-label">
|
||||
<span className="method-list-item-label-name">
|
||||
id
|
||||
</span>
|
||||
<span className="method-list-item-label-badge required">
|
||||
required
|
||||
</span>
|
||||
<span className="method-list-item-validation">
|
||||
<code>string</code>
|
||||
</span>
|
||||
</h4>
|
||||
<div class="method-list-item-description">
|
||||
|
||||
The unique identifier of the bucket you would like to retrieve.
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `select`
|
||||
- `objects` permissions: none
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Get bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.getBucket('avatars')
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
id: storage-listbuckets
|
||||
title: "listBuckets()"
|
||||
slug: storage-listbuckets
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Retrieves the details of all Storage buckets within an existing product.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.listBuckets()
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `select`
|
||||
- `objects` permissions: none
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### List buckets
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.listBuckets()
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
id: storage-updatebucket
|
||||
title: "updateBucket()"
|
||||
slug: storage-updatebucket
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Updates a new Storage bucket
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.updateBucket('avatars', { public: false });
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Policy permissions required:
|
||||
- `buckets` permissions: `update`
|
||||
- `objects` permissions: none
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Update bucket
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.storage
|
||||
.updateBucket('avatars', { public: false });
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,147 +0,0 @@
|
||||
---
|
||||
id: stream
|
||||
title: "stream()"
|
||||
slug: stream
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Notifies of data at the queried table.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase
|
||||
.from('countries')
|
||||
.stream()
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- `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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Listening to a specific table
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase
|
||||
.from('countries')
|
||||
.stream()
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to a specific rows within a table
|
||||
|
||||
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
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase
|
||||
.from('countries:id=eq.120')
|
||||
.stream()
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `order()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase
|
||||
.from('countries')
|
||||
.stream()
|
||||
.order('name', ascending: false)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### With `limit()`
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
supabase
|
||||
.from('countries')
|
||||
.stream()
|
||||
.order('name', ascending: false)
|
||||
.limit(10)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,237 +0,0 @@
|
||||
---
|
||||
id: subscribe
|
||||
title: "on().subscribe()"
|
||||
slug: subscribe
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Subscribe to realtime changes in your database.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.all, (payload) {
|
||||
// Handle realtime payload
|
||||
})
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- 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
|
||||
|
||||
### Listen to all database changes
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.all, (payload) {
|
||||
// Handle realtime payload
|
||||
})
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to a specific table
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.all, (payload) {
|
||||
// Handle realtime payload
|
||||
})
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to inserts
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.insert, (payload) {
|
||||
// Handle realtime payload
|
||||
})
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to updates
|
||||
|
||||
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;
|
||||
```
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.update, (payload) {
|
||||
// Handle realtime payload
|
||||
})
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to deletes
|
||||
|
||||
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;
|
||||
```
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.delete, (payload) {
|
||||
// Handle realtime payload
|
||||
})
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to multiple events
|
||||
|
||||
You can chain listeners if you want to listen to multiple events for each table.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries')
|
||||
.on(SupabaseEventTypes.insert, handleInsert)
|
||||
.on(SupabaseEventTypes.delete, handleDelete)
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listening to row level changes
|
||||
|
||||
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.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final mySubscription = supabase
|
||||
.from('countries:id=eq.200')
|
||||
.on(SupabaseEventTypes.update, handleRecordUpdated)
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,147 +0,0 @@
|
||||
---
|
||||
id: textsearch
|
||||
title: ".textSearch()"
|
||||
slug: textsearch
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Text search
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('quotes')
|
||||
.select('catchphrase')
|
||||
.textSearch('catchphrase', "'fat' & 'cat'",
|
||||
config: 'english'
|
||||
)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Basic normalization
|
||||
|
||||
Uses PostgreSQL's `plainto_tsquery` function.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('quotes')
|
||||
.select('catchphrase')
|
||||
.textSearch('catchphrase', "'fat' & 'cat'",
|
||||
type: TextSearchType.plain,
|
||||
config: 'english'
|
||||
)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Full normalization
|
||||
|
||||
Uses PostgreSQL's `phraseto_tsquery` function.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('quotes')
|
||||
.select('catchphrase')
|
||||
.textSearch('catchphrase', "'fat' & 'cat'",
|
||||
type: TextSearchType.phrase,
|
||||
config: 'english'
|
||||
)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Full normalization
|
||||
|
||||
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.
|
||||
- `OR`: the word “or” will be converted to the | operator.
|
||||
- `-`: a dash will be converted to the ! operator.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('quotes')
|
||||
.select('catchphrase')
|
||||
.textSearch('catchphrase', "'fat or cat'",
|
||||
type: TextSearchType.websearch,
|
||||
config: 'english'
|
||||
)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,109 +0,0 @@
|
||||
---
|
||||
id: update
|
||||
title: "Modify data: update()"
|
||||
slug: update
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Performs an UPDATE on the table.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Middle Earth' })
|
||||
.match({ 'name': 'Auckland' })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
TODO update the link to dart
|
||||
- `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Updating your data
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.update({ 'name': 'Middle Earth' })
|
||||
.match({ 'name': 'Auckland' })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Updating JSON data
|
||||
|
||||
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.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('users')
|
||||
.update({
|
||||
'address': {
|
||||
'street': 'Melrose Place',
|
||||
'postcode': 90210
|
||||
}
|
||||
})
|
||||
.eq('address->postcode', 90210)
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,128 +0,0 @@
|
||||
---
|
||||
id: upsert
|
||||
title: "Upsert data: upsert()"
|
||||
slug: upsert
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Performs an UPSERT into the table.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('messages')
|
||||
.upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- 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
|
||||
|
||||
### Upsert your data
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('messages')
|
||||
.upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Upserting into tables with constraints
|
||||
|
||||
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`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('users')
|
||||
.upsert({ 'username': 'supabot' }, { 'onConflict': 'username' })
|
||||
.execute();
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Return the exact number of rows
|
||||
|
||||
Allowed values for count option are `exact`, `planned` and `estimated`.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="dart"
|
||||
groupId="reference/dart"
|
||||
values={[{ label: 'Dart', value: 'dart' }]}>
|
||||
|
||||
<TabsPanel id="dart" label="dart">
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('users')
|
||||
.upsert({
|
||||
'id': 3,
|
||||
'message': 'foo',
|
||||
'username': 'supabot'
|
||||
})
|
||||
.execute(count: CountOption.exact);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
id: using-filters
|
||||
title: "Using Filters"
|
||||
slug: using-filters
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Filters can be used on `select()`, `update()`, and `delete()` queries.
|
||||
|
||||
If a Stored Procedure returns a table response, you can also apply filters.
|
||||
|
||||
### Applying Filters
|
||||
|
||||
You must apply your filters to the end of your query. For example:
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.eq('name', 'The Shire') // Correct
|
||||
.execute();
|
||||
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.eq('name', 'The Shire') // Incorrect
|
||||
.select('name, country_id')
|
||||
.execute();
|
||||
```
|
||||
|
||||
### Chaining
|
||||
|
||||
Filters can be chained together to produce advanced queries. For example:
|
||||
|
||||
```dart
|
||||
final res = await supabase
|
||||
.from('cities')
|
||||
.select('name, country_id')
|
||||
.gte('population', 1000)
|
||||
.lt('population', 10000)
|
||||
.execute();
|
||||
```
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
id: using-modifiers
|
||||
title: "Using Modifiers"
|
||||
slug: using-modifiers
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/dart.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Modifiers can be used on `select()` queries.
|
||||
|
||||
If a Stored Procedure returns a table response, you can also apply modifiers to the `rpc()` function.
|
||||
@@ -1,119 +0,0 @@
|
||||
---
|
||||
id: changing-timezones
|
||||
title: "Changing Timezones"
|
||||
slug: changing-timezones
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Data types.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
alter database postgres
|
||||
set timezone to 'America/New_York';
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- View a full list of timezones on [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Change timezone
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
alter database postgres
|
||||
set timezone to 'America/New_York';
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Full list of timezones
|
||||
|
||||
Get a full list of timezones supported by your database. This will return the following columns:
|
||||
|
||||
- `name`: Time zone name
|
||||
- `abbrev`: Time zone abbreviation
|
||||
- `utc_offset`: Offset from UTC (positive means east of Greenwich)
|
||||
- `is_dst`: True if currently observing daylight savings
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
select name, abbrev, utc_offset, is_dst
|
||||
from pg_timezone_names()
|
||||
order by name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Search for a specific timezone
|
||||
|
||||
Use `ilike` (case insensitive search) to find specific timezones.
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
select *
|
||||
from pg_timezone_names()
|
||||
where name ilike '%york%';
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,95 +0,0 @@
|
||||
---
|
||||
id: columns
|
||||
title: "Columns"
|
||||
slug: columns
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Creating columns.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create table table_name (
|
||||
id integer primary key,
|
||||
data jsonb,
|
||||
name text
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### During table creation
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create table table_name (
|
||||
id integer primary key,
|
||||
data jsonb,
|
||||
name text
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Create column
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
alter table new_table
|
||||
add new_column text;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,135 +0,0 @@
|
||||
---
|
||||
id: connection-strings
|
||||
title: "Connection Strings"
|
||||
slug: connection-strings
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
There are various ways to connect to your database, depending on the configuration of your Postgres instance and the tool which you are connecting with.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```bash
|
||||
postgres://postgres:postgres@localhost:5432/postgres
|
||||
# or
|
||||
postgresql://postgres:postgres@localhost:5432/postgres
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- [Official Documentation](https://www.postgresql.org/docs/current/libpq-connect.html).
|
||||
- Avoid using special characters usernames and passwords. If you use special characters in a connection URL, you'll need to URL encode any special characters.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic connection string
|
||||
|
||||
If you're using a default setup, your postgres connection string will likely be in the format:
|
||||
|
||||
`postgres://{user}:{password}@{host}:{port}/{database_name}`
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```bash
|
||||
postgres://postgres:postgres@localhost:5432/postgres
|
||||
# or
|
||||
postgresql://postgres:postgres@localhost:5432/postgres
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### JDBC
|
||||
|
||||
See full [documentation](http://jdbc.postgresql.org/documentation/head/connect.html).
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```bash
|
||||
jdbc:postgresql://{host}:{port}/{database_name}
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### ADO.NET
|
||||
|
||||
See full [documentation](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html).
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```bash
|
||||
Server=host;Port=5432;User Id=username;Password=secret;Database=database_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### PHP
|
||||
|
||||
See full [documentation](http://php.net/manual/en/book.pgsql.php).
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```bash
|
||||
host=hostname port=5432 dbname=databasename user=username password=secret
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,53 +0,0 @@
|
||||
---
|
||||
id: database-passwords
|
||||
title: "Database Passwords"
|
||||
slug: database-passwords
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Manage the passwords of your database users using any super user.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Password reset
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
alter user postgres
|
||||
with password 'new_password';
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,53 +0,0 @@
|
||||
---
|
||||
id: database-users
|
||||
title: "Database Users"
|
||||
slug: database-users
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Users and Roles are almost interchangeable.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create New User
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create user new_user
|
||||
with password 'hello';
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
id: index
|
||||
title: "Getting started"
|
||||
slug: getting-started
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
|
||||
PostgreSQL, also known as Postgres, is a free and open-source relational
|
||||
database management system emphasizing extensibility and SQL compliance.
|
||||
It was originally named POSTGRES, referring to its origins as a successor
|
||||
to the Ingres database developed at the University of California, Berkeley.
|
||||
@@ -1,210 +0,0 @@
|
||||
---
|
||||
id: publications
|
||||
title: "Publications"
|
||||
slug: publications
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Publications are a way of grouping changes generated from a table or a group of tables.
|
||||
These changes can then be sent to other systems (usually another Postgres database).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create a Publication
|
||||
|
||||
This publication will contain all changes to all tables.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Create a Publication which listens to individual tables
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create publication publication_name
|
||||
for table table_one, table_two;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Add tables to an existing publication
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
alter publication publication_name
|
||||
add table table_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listens to inserts only
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables
|
||||
with (publish = 'insert');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listens to updates only
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables
|
||||
with (publish = 'update');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Listens to deletions only
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables
|
||||
with (publish = 'delete');
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Remove a Publication
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
drop publication if exists publication_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Recreate a Publication
|
||||
|
||||
If you are planning to re-create a publication, it's best to do it in a transaction to ensure the operation succeeds.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
begin;
|
||||
-- remove the realtime publication
|
||||
drop publication if exists publication_name;
|
||||
|
||||
-- re-create the publication but don't enable it for any tables
|
||||
create publication publication_name;
|
||||
commit;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,114 +0,0 @@
|
||||
---
|
||||
id: schemas
|
||||
title: "Schemas"
|
||||
slug: schemas
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Schemas are like "folders". They help to keep your database organized.
|
||||
|
||||
Schemas are particularly useful for security. You can set different permissions on each schema.
|
||||
For example, you might want to use a `public` schema for user-facing data, and an `auth` schema for all logins and secured data.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create schema schema_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Schemas contain [tables](/docs/reference/postgres/tables), columns, triggers, functions, etc.
|
||||
- Postgres comes with a `public` schema set up by default.
|
||||
- It is best practice to use lowercase and underscores when naming schemas. For example: `schema_name`, not `Schema Name`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Creating a schema
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create schema schema_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Removing a schema
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
drop schema if exists schema_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Using special characters
|
||||
|
||||
Although it's not recommended, you can use uppercase and spaces when naming your schema by wrapping the name with double-quotes.
|
||||
As a result, you will always need to use double-quotes when referencing your schema.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create schema "Schema Name";
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
@@ -1,161 +0,0 @@
|
||||
---
|
||||
id: tables
|
||||
title: "Tables"
|
||||
slug: tables
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/postgres.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
Tables are similar to excel spreadsheets. They contain columns & rows of data. There are a few key differences from a spreadsheet however:
|
||||
|
||||
- Every column is a strict type of data. When you set up a column, you must define what "data type" it is.
|
||||
- Tables can be joined together through relationships. For example you can have a "users" table, which is joined to a "teams" table.
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create table table_name (
|
||||
id integer primary key,
|
||||
data jsonb,
|
||||
name text
|
||||
);
|
||||
|
||||
# with schema
|
||||
create table schema_name.table_name (
|
||||
id integer primary key,
|
||||
data jsonb,
|
||||
name text
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
- Tables contain columns, rows, triggers, comments,
|
||||
- It is best practice to use lowercase and underscores when naming tables. For example: `table_name`, not `Table Name`.
|
||||
- Tables belong to [schemas](/docs/reference/postgres/schemas). If you don't explicitly pass the schema, Postgres will assume that you want to create the table in the `public` schema.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Create table
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create table table_name (
|
||||
id integer primary key,
|
||||
data jsonb,
|
||||
name text
|
||||
);
|
||||
|
||||
# with schema
|
||||
create table schema_name.table_name (
|
||||
id integer primary key,
|
||||
data jsonb,
|
||||
name text
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Primary keys using multiple columns
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
create table table_name (
|
||||
column_1 data_type,
|
||||
column_2 data_type
|
||||
-- Constraints:
|
||||
primary key (column_1, column_2)
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Multiple foreign keys to the same table
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
alter table table_name
|
||||
add constraint constraint_name_1 foreign key (column_1) references foreign_table(id),
|
||||
add constraint constraint_name_2 foreign key (column_2) references foreign_table(id);
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Delete a table
|
||||
|
||||
|
||||
|
||||
<Tabs
|
||||
defaultActiveId="sql"
|
||||
groupId="reference/postgres"
|
||||
values={[{ label: 'SQL', value: 'sql' }]}>
|
||||
|
||||
<TabsPanel id="sql" label="sql">
|
||||
|
||||
```sql
|
||||
delete table if exists table_name;
|
||||
```
|
||||
|
||||
|
||||
</TabsPanel>
|
||||
|
||||
</Tabs>
|
||||
37
apps/temp-docs/docs/reference/api.mdx
Normal file
37
apps/temp-docs/docs/reference/api.mdx
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
slug: /
|
||||
sidebar_position: 1
|
||||
sidebar_label: Supabase API
|
||||
---
|
||||
|
||||
# Supabase API
|
||||
|
||||
The Supabase API allows you to manage your projects programmatically.
|
||||
|
||||
## Status
|
||||
|
||||
The Supabase API is in `beta`. It is usable in it's current state, but it's likely that there will be breaking changes.
|
||||
|
||||
## Authentication
|
||||
|
||||
All API requests require a Supabase Personal token to be included in the Authorization header: `Authorization Bearer <supabase_personal_token`.
|
||||
To generate or manage your API token, visit your [account](https://app.supabase.com/account/tokens) page.
|
||||
Your API tokens carry the same privileges as your user account, so be sure to keep it secret.
|
||||
|
||||
```bash
|
||||
$ curl https://api.supabase.com/v1/projects \
|
||||
-H "Authorization: Bearer sbp_bdd0••••••••••••••••••••••••••••••••4f23"
|
||||
```
|
||||
|
||||
All API requests must be authenticated and made over HTTPS.
|
||||
|
||||
## Rate limits
|
||||
|
||||
The API is currently subject to our fair-use policy. In the future, are likely to introduce rate limits.
|
||||
All resources created via the API are subject to the pricing detailed on our [Pricing](https://supabase.com/pricing) pages.
|
||||
|
||||
## Additional links
|
||||
|
||||
- [OpenAPI Docs](https://api.supabase.com/api/v1)
|
||||
- [OpenAPI Spec](https://api.supabase.com/api/v1-json)
|
||||
- Reporting bugs and issues: [github.com/supabase/supabase](https://github.com/supabase/supabase)
|
||||
12
apps/temp-docs/docs/reference/api/release-notes.mdx
Normal file
12
apps/temp-docs/docs/reference/api/release-notes.mdx
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
id: release-notes
|
||||
---
|
||||
|
||||
# Release Notes
|
||||
|
||||
## v1.0.0 {#1.0.0}
|
||||
|
||||
Adds the following routes:
|
||||
|
||||
- `/v1/organizations`: Manage Supabase organizations
|
||||
- `/v1/projects`: Manage Supabase projects
|
||||
22
apps/temp-docs/docs/reference/auth.mdx
Normal file
22
apps/temp-docs/docs/reference/auth.mdx
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
slug: /
|
||||
sidebar_position: 1
|
||||
sidebar_label: Auth Server
|
||||
---
|
||||
|
||||
# Supabase Auth Server
|
||||
|
||||
The Supabase Auth Server (GoTrue) is a JSON Web Token (JWT)-based API for managing users and issuing access tokens.
|
||||
|
||||
GoTrue is an open-source API written in Golang, that acts as a self-standing API service for handling user registration and authentication for JAM projects. It's based on OAuth2 and JWT and handles user signup, authentication, and custom user data.
|
||||
|
||||
## Client libraries
|
||||
|
||||
- [JavaScript](https://github.com/supabase/gotrue-js)
|
||||
- [Dart](https://github.com/supabase/gotrue-dart)
|
||||
|
||||
## Additional Links
|
||||
|
||||
- [Source Code](https://github.com/supabase/gotrue)
|
||||
- [Known bugs and issues](https://github.com/supabase/gotrue/issues)
|
||||
- [Auth Guides](https://supabase.com/docs/guides/auth)
|
||||
7
apps/temp-docs/docs/reference/auth/release-notes.mdx
Normal file
7
apps/temp-docs/docs/reference/auth/release-notes.mdx
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
id: release-notes
|
||||
---
|
||||
|
||||
# Release Notes
|
||||
|
||||
All release notes can be found in the [GitHub Releases](https://github.com/supabase/gotrue/releases) page.
|
||||
29
apps/temp-docs/docs/reference/cli.mdx
Normal file
29
apps/temp-docs/docs/reference/cli.mdx
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
id: intro
|
||||
slug: /
|
||||
sidebar_position: 1
|
||||
sidebar_label: Supabase CLI
|
||||
hide_table_of_contents: true
|
||||
---
|
||||
|
||||
# Supabase CLI
|
||||
|
||||
The Supabase CLI provides tools to develop your project locally and deploy to the Supabase Platform.
|
||||
The CLI is still under development, but it contains all the functionality for working with your Supabase projects and the Supabase Platform.
|
||||
|
||||
- Run Supabase locally: [`supabase start`](https://supabase.com/docs/reference/cli/usage#supabase-start)
|
||||
- Manage database migrations: [`supabase migration`](https://supabase.com/docs/reference/cli/usage#supabase-migration)
|
||||
- CI/CD for releasing to production: [`supabase db push`](https://supabase.com/docs/reference/cli/usage#supabase-db-push)
|
||||
- Manage your Supabase projects: [`supabase projects`](https://supabase.com/docs/reference/cli/usage#supabase-projects)
|
||||
- Generate types directly from your database schema: [`supabase gen types`](https://supabase.com/docs/reference/cli/usage#supabase-gen)
|
||||
- A [community-supported GitHub Action](https://github.com/lyqht/generate-supabase-db-types-github-action) to generate TypeScript types
|
||||
- Shell autocomplete: [`supabase completion`](https://supabase.com/docs/reference/cli/usage#supabase-completion)
|
||||
- A [community-supported Fig autocomplete spec](https://fig.io/manual/supabase) for macOS terminal
|
||||
|
||||
## Additional Links
|
||||
|
||||
- [Install the Supabase CLI](/docs/guides/cli)
|
||||
- [Source code](https://github.com/supabase/cli)
|
||||
- [Known bugs and issues](https://github.com/supabase/cli/issues)
|
||||
- [Supabase CLI v1 and Admin API Beta](https://supabase.com/blog/supabase-cli-v1-and-admin-api-beta)
|
||||
- [The CLI team announcing CLI V1 and Admin API Beta - Video](https://www.youtube.com/watch?v=OpPOaJI_Z28)
|
||||
@@ -1,25 +0,0 @@
|
||||
---
|
||||
id: index
|
||||
title: "Getting started"
|
||||
slug: getting-started
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
The Supabase CLI can be found in our [CLI](https://github.com/supabase/cli) repository.
|
||||
|
||||
The CLI is still under heavy development, but it will contain all the functionality for working with Supabase projects and the Supabase platform.
|
||||
|
||||
- [x] Running Supabase locally
|
||||
- [x] Self-hosting
|
||||
- [ ] Managing database migrations (in progress)
|
||||
- [ ] Pushing your local changes to production
|
||||
- [ ] Manage your Supabase Account
|
||||
- [ ] Manage your Supabase Projects
|
||||
- [ ] Generating types directly from your database schema
|
||||
- [ ] Generating API and validation schemas from your database
|
||||
|
||||
## Installing the CLI
|
||||
|
||||
```bash
|
||||
npm install supabase -g
|
||||
```
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
id: config-reference
|
||||
title: "Config reference"
|
||||
slug: config-reference
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
The config file resides in `supabase/config.json` after you run `supabase init`.
|
||||
|
||||
#### `projectId` (required)
|
||||
|
||||
A string used to distinguish different Supabase projects on the same host. Defaults to the working directory name when running `supabase init`.
|
||||
|
||||
#### `ports.api` (required)
|
||||
|
||||
Host port used for the API URL. Defaults to `54321`.
|
||||
|
||||
#### `ports.db` (required)
|
||||
|
||||
Host port used for the DB URL. Defaults to `54322`.
|
||||
|
||||
#### `ports.studio` (required)
|
||||
|
||||
Host port used for Supabase Studio. Defaults to `54323`.
|
||||
|
||||
#### `ports.inbucket` (optional)
|
||||
|
||||
Host port used for the web interface of Inbucket email testing server. When not specified, emails are automatically confirmed. When specified, emails are not sent to the recipient, but rather monitored and accessible via the web interface.
|
||||
|
||||
#### `dbVersion` (required)
|
||||
|
||||
Server version number used for the database. This needs to match the server version number of the remote database you intend to link to with `supabase db remote set`. You can retrieve it by running `SHOW server_version_num`.
|
||||
@@ -1,27 +0,0 @@
|
||||
---
|
||||
id: index
|
||||
title: "About"
|
||||
slug: about
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
The Supabase CLI can be found in our [CLI](https://github.com/supabase/cli) repository.
|
||||
|
||||
- [x] Running Supabase locally
|
||||
- [x] Managing database migrations
|
||||
- [x] Pushing your local changes to production
|
||||
- [ ] Manage your Supabase Account
|
||||
- [ ] Manage your Supabase Projects
|
||||
- [ ] Generating types directly from your database schema
|
||||
- [ ] Generating API and validation schemas from your database
|
||||
|
||||
## Installing the CLI
|
||||
|
||||
Installation instructions can be found [here](https://github.com/supabase/cli#install-the-cli).
|
||||
|
||||
## Support
|
||||
|
||||
Report issues to our [issue tracker](https://github.com/supabase/cli/issues).
|
||||
7
apps/temp-docs/docs/reference/cli/release-notes.mdx
Normal file
7
apps/temp-docs/docs/reference/cli/release-notes.mdx
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
id: release-notes
|
||||
---
|
||||
|
||||
# Release Notes
|
||||
|
||||
All release notes can be found in the [GitHub Releases page](https://github.com/supabase/cli/releases).
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
id: supabase-db-branch-create
|
||||
title: "supabase db branch create"
|
||||
slug: supabase-db-branch-create
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
```
|
||||
Create a branch.
|
||||
|
||||
Usage:
|
||||
supabase db branch create <branch name>
|
||||
```
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
id: supabase-db-branch-delete
|
||||
title: "supabase db branch delete"
|
||||
slug: supabase-db-branch-delete
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
```
|
||||
Delete a branch.
|
||||
|
||||
Usage:
|
||||
supabase db branch delete <branch name>
|
||||
```
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
id: supabase-db-branch-list
|
||||
title: "supabase db branch list"
|
||||
slug: supabase-db-branch-list
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
```
|
||||
List branches.
|
||||
|
||||
Usage:
|
||||
supabase db branch list
|
||||
```
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
id: supabase-db-changes
|
||||
title: "supabase db changes"
|
||||
slug: supabase-db-changes
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
```
|
||||
Diffs the local database with current migrations, then print the diff to standard output.
|
||||
|
||||
Usage:
|
||||
supabase db changes
|
||||
```
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
id: supabase-db-commit
|
||||
title: "supabase db commit"
|
||||
slug: supabase-db-commit
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
```
|
||||
Diffs the local database with current migrations, writing it as a new migration.
|
||||
|
||||
Usage:
|
||||
supabase db commit <migration name>
|
||||
```
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
id: supabase-db-push
|
||||
title: "supabase db push"
|
||||
slug: supabase-db-push
|
||||
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/cli.yml
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabsPanel from '@theme/TabsPanel';
|
||||
|
||||
```
|
||||
Push new migrations to the remote database.
|
||||
|
||||
Usage:
|
||||
supabase db push
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user