lolopinto / ent

MIT License
51 stars 6 forks source link

CustomClauseQuery without a required clause? #1769

Closed ashleyxue529 closed 8 months ago

ashleyxue529 commented 8 months ago

I'm trying to query for all objects in my db for a graphql connection, is there some no-op clause I could use? Or is there another query I should use?

RIght now I'm using:

    return new CustomClauseQuery(omniVC, {
      loadEntOptions: Object.loaderOptions(),
      clause: <what do i put here>?
      name: "objects_connection",
      orderby: [
        {
          column: "created_at",
          direction: "DESC",
        },
      ],
    });
Swahvay commented 8 months ago

You could use Expression('1 = 1').

Swahvay commented 8 months ago

Or query.NotEq('id', null).

ashleyxue529 commented 8 months ago

aha yes! was looking for something like Expression, thank you :)

lolopinto commented 8 months ago

i intentionally didn't make it easy to do table scans but yah Expression works here

The other thing you can do is Foo.loadCustom('select * from blah') but you don't get a connection for that only a list