edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Extend splats in querybuilder to match edgedb syntax

Open jaclarke opened this issue 2 years ago • 2 comments

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

  • [ ] Add double star ['**'] that contains all properties and links
  • [ ] Try to add an overload to e.is to make this possible for polymorphic splats:
e.select(e.Person, () => ({
  ...e.is(e.Hero)['*']
}));

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

jaclarke avatar Mar 08 '23 22:03 jaclarke

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["*"] }),
});

scotttrinh avatar Dec 19 '23 21:12 scotttrinh