0

Postgraphile 过滤器或正在工作并且正在工作

当我尝试或在查询过滤器中检查解释的资源管理器时,我发现它已更改为,这就是为什么它总是为而不是为 or

{
  allCashierViewsList(
    filter: {locationId: {equalTo: "454"} or: {name: {equalTo: "STORE MANAGER"}}}
  ) {
    posId
    name
    locationId
  }
}

这就是探险家所说的。

{
  "data": {
    "allCashierViewsList": []
  },
  "explain": [
    {
      "query": "select to_json(((__local_0__.\"pos_id\"))::text) as \"posId\", to_json((__local_0__.\"name\")) as \"name\", to_json(((__local_0__.\"location_id\"))::text) as \"locationId\" from (select __local_0__.*\nfrom \"public\".\"cashier_view\" as __local_0__\n\nwhere (((__local_0__.\"name\" = $1)) and ((__local_0__.\"location_id\" = $2))) and (TRUE) and (TRUE)\n\n\n) __local_0__",
      "plan": "Subquery Scan on __local_0__  (cost=3542.55..3543.19 rows=1 width=96)\n  Filter: (((__local_0__.name)::text = 'STORE MANAGER'::text) AND (__local_0__.location_id = '454'::bigint))\n  ->  Unique  (cost=3542.55..3542.71 rows=31 width=24)\n        ->  Sort  (cost=3542.55..3542.63 rows=31 width=24)\n              Sort Key: c.pos_id\n              ->  Nested Loop  (cost=8.38..3541.78 rows=31 width=24)\n                    ->  Hash Join  (cost=8.09..3390.49 rows=478 width=16)\n                          Hash Cond: (v.data_point_mapping_id = dpm.id)\n                          ->  Seq Scan on value_table v  (cost=0.00..2855.33 rows=136633 width=24)\n                          ->  Hash  (cost=8.08..8.08 rows=1 width=8)\n                                ->  Hash Join  (cost=4.78..8.08 rows=1 width=8)\n                                      Hash Cond: (dpm.data_point_id = d.id)\n                                      ->  Seq Scan on data_point_mapping dpm  (cost=0.00..2.93 rows=93 width=16)\n                                      ->  Hash  (cost=4.77..4.77 rows=1 width=8)\n                                            ->  Hash Join  (cost=2.18..4.77 rows=1 width=8)\n                                                  Hash Cond: (d.reference_table_id = r.id)\n                                                  ->  Seq Scan on data_point d  (cost=0.00..2.47 rows=47 width=16)\n                                                  ->  Hash  (cost=2.16..2.16 rows=1 width=8)\n                                                        ->  Index Scan using reference_table_type_unique on reference_table r  (cost=0.14..2.16 rows=1 width=8)\n                                                              Index Cond: ((type)::text = 'Cashier'::text)\n                    ->  Index Scan using cashier_loc_pos_date_idx on cashier c  (cost=0.29..0.31 rows=1 width=24)\n                          Index Cond: ((location_id = v.location_id) AND (pos_id = v.pos_id))"
    }
  ]
}
4

1 回答 1

0

我知道了如何在 PostGraphile 的过滤器中使用“或”运算符。我发帖是因为它可能对其他人有帮助。

{
  allCashierViewsList(
    filter: {
      or: [
        {locationId: { equalTo: "454" } } 
        {name: { equalTo: "STORE DIRECTOR" } } 
      ]
    }
  ) {
    posId
    name
    locationId
  }
}
于 2021-07-06T11:11:39.663 回答