lolopinto / ent

MIT License
52 stars 6 forks source link

CustomClauseQuery without a required clause? #1769

Closed ashleyxue529 closed 9 months ago

ashleyxue529 commented 9 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 9 months ago

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

Swahvay commented 9 months ago

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

ashleyxue529 commented 9 months ago

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

lolopinto commented 9 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