maybeSingle()
将数据(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()
.eq('name', 'Singapore')
.maybeSingle()
{
"status": 200,
"statusText": "OK"
}