使用过滤器

过滤器可以用在select(), update(), 和 delete()方法上

如果一个Postgres函数返回一个表类型的响应,你也可以应用过滤器。

应用过滤器

你必须把你的过滤器应用到查询的最后。比如说:

const { data, error } = await supabase
  .from('cities')
  .select('name, country_id')
  .eq('name', 'The Shire')    // Correct

const { data, error } = await supabase
  .from('cities')
  .eq('name', 'The Shire')    // Incorrect
  .select('name, country_id')

链式调用

过滤器可以链式调用,进行高级查询。比如说。

const { data, error } = await supabase
  .from('cities')
  .select('name, country_id')
  .gte('population', 1000)
  .lt('population', 10000)

results matching ""

    No results matching ""