agiletiger / agiletiger/ojotas

investigate: using sql aliases to give hints to ojotas on how do the assemble

オープン
#3 コメント 2 件 リアクション 0 件 担当者 1 名 @ivanlolivier が担当を希望しています GitHub で見る
主要言語
TypeScript
スター
9
フォーク
4
PR マージ指標
30日以内にマージされた PR はありません

説明

today ojotas needs a list of identifiers to know how to do the assemble when querying an entity with its relations
it also needs a config file, the ojotasrc.json with aliases and relations

another way would be to have sql queries like this one

```sql
select
u.name as 'name',
p.title as 'posts[].title',
p.content as 'posts[].content'
from
users u left join
posts p on u.id = p.user_id
;
```

with this we would not need the configuaration file and it will be more flexible like if we want to return a single post we could do

```sql
select
u.name as 'name',
p.title as 'lastPost.title',
p.content as 'lastPost.content'
from
users u left join
posts p on u.id = p.user_id
where
u.id = 1
order by p.createdAt desc
limit 1
;
```

instrad of having an array with just one post we could directy have an object lastPost.

I believe both ways could co exist depending on user preference on how to work

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。