Open aleclarson opened 2 years ago
db.select( t.tweet(tweet => ({ ...tweet, author: db.get(t.user, tweet.author), })) )
By spreading tweet into the mapping, all columns should be selected and an additional author column is added (which overrides the tweet.author column).
tweet
author
tweet.author
Implementing this should be straight-forward. Just need to define the ownKeys trap on the proxy handler that tweet uses. https://github.com/alloc/tusken/blob/96b4ddd24e30ae5f55936f29ade1556319b66924/src/database/selector.ts#L17
ownKeys
By spreading
tweet
into the mapping, all columns should be selected and an additionalauthor
column is added (which overrides thetweet.author
column).Implementing this should be straight-forward.
Just need to define the
ownKeys
trap on the proxy handler thattweet
uses. https://github.com/alloc/tusken/blob/96b4ddd24e30ae5f55936f29ade1556319b66924/src/database/selector.ts#L17