mirror of
https://github.com/supabase/supabase.git
synced 2026-05-24 04:00:47 +08:00
186 lines
2.7 KiB
Plaintext
186 lines
2.7 KiB
Plaintext
---
|
|
id: lt
|
|
title: ".lt()"
|
|
slug: lt
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.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="js"
|
|
groupId="reference/supabase-js"
|
|
values={[{ label: 'JavaScript', value: 'js' }]}>
|
|
|
|
<TabsPanel id="js" label="js">
|
|
|
|
```js
|
|
const { data, error } = await supabase
|
|
.from('cities')
|
|
.select('name, country_id')
|
|
.lt('country_id', 250)
|
|
```
|
|
|
|
|
|
</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="js"
|
|
groupId="reference/supabase-js"
|
|
values={[{ label: 'JavaScript', value: 'js' }]}>
|
|
|
|
<TabsPanel id="js" label="js">
|
|
|
|
```js
|
|
const { data, error } = await supabase
|
|
.from('cities')
|
|
.select('name, country_id')
|
|
.lt('country_id', 250)
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs>
|
|
|
|
### With `update()`
|
|
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="js"
|
|
groupId="reference/supabase-js"
|
|
values={[{ label: 'JavaScript', value: 'js' }]}>
|
|
|
|
<TabsPanel id="js" label="js">
|
|
|
|
```js
|
|
const { data, error } = await supabase
|
|
.from('cities')
|
|
.update({ name: 'Mordor' })
|
|
.lt('country_id', 250)
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs>
|
|
|
|
### With `delete()`
|
|
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="js"
|
|
groupId="reference/supabase-js"
|
|
values={[{ label: 'JavaScript', value: 'js' }]}>
|
|
|
|
<TabsPanel id="js" label="js">
|
|
|
|
```js
|
|
const { data, error } = await supabase
|
|
.from('cities')
|
|
.delete()
|
|
.lt('country_id', 250)
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs>
|
|
|
|
### With `rpc()`
|
|
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="js"
|
|
groupId="reference/supabase-js"
|
|
values={[{ label: 'JavaScript', value: 'js' }]}>
|
|
|
|
<TabsPanel id="js" label="js">
|
|
|
|
```js
|
|
// Only valid if the Postgres function returns a table type.
|
|
const { data, error } = await supabase
|
|
.rpc('echo_all_cities')
|
|
.lt('country_id', 250)
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs> |