single()
将数据(data)
作为单个对象返回,而不是返回一个对象数组。
create table
countries (id int8 primary key, name text);
insert into
countries (id, name)
values
(1, 'Afghanistan'),
(2, 'Albania'),
(3, 'Algeria');
const { data, error } = await supabase
.from('countries')
.select('name')
.limit(1)
.single()
{
"data": {
"name": "Afghanistan"
},
"status": 200,
"statusText": "OK"
}