Query Postgres view using ent in golang

61 Views Asked by At

Given:

  • ent table schema defined in golang, resulting in below table:

create table scans ( id bigint generated by default as identity primary key, app_id bigint not null }

  • view of the table in plain sql I ran against postgres.
SELECT scans.id,
       scan.app_id,    
       row_number() OVER (PARTITION BY scans.app_id ORDER BY scans.id) AS scan_id
FROM main.scans;

How to query the view using ent? I'm not sure it's possible according to this github issue.

Is querying the view using external go postgres library the only way?

0

There are 0 best solutions below