使用过滤器
过滤器可以用于select()
、update()
和delete()
操作。
如果一个存储过程返回一个表的响应,你也可以应用过滤器。
应用过滤器
你必须把你的过滤器放在查询最后,譬如:
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();
链式调用
过滤器可以链式调用,从而进行高级查询,譬如:
final res = await supabase
.from('cities')
.select('name, country_id')
.gte('population', 1000)
.lt('population', 10000)
.execute();