edgedb / edgedb-js

The official TypeScript/JS client library and query builder for EdgeDB
https://edgedb.com
Apache License 2.0
515 stars 66 forks source link

Extend splats in querybuilder to match edgedb syntax #558

Open jaclarke opened 1 year ago

jaclarke commented 1 year ago

(Implemented in EdgeDB here: https://github.com/edgedb/edgedb/pull/5080)

// Currently have to do this: e.select(e.Person, () => ({ ...e.is(e.Hero, e.Hero['*']) }));

scotttrinh commented 11 months ago

In the meantime, if you need all of the links of an object, you'll have to manually add them, but you can use the single splat to make it a little easier to write:

e.select(e.Movie, (movie) => ({
  ...movie["*"],
  characters: (c) => ({ ...c["*"] }),
  profile: (p) => ({ ...p["*"] }),
});