Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full outer joins #9

Open
gaboelnuevo opened this issue Sep 30, 2018 · 4 comments
Open

Support full outer joins #9

gaboelnuevo opened this issue Sep 30, 2018 · 4 comments

Comments

@gaboelnuevo
Copy link

gaboelnuevo commented Sep 30, 2018

I created this extension in JS for adding this feature.
If it is of interest I can adapt to TS and do a pull request

Please check: https://gist.github.com/gaboelnuevo/51117a3124cb730c1c8650b50bf201a0

Example:

fullOuterJoin(query: RealmQuery): RealmQuery
Join queries like a full outer join

let query1 = RealmQuery
  .where(realm.objects('Person'))
  .in('id', [1001, 1002])
let query2 = RealmQuery
  .where(realm.objects('Person'))
  .greaterThan('age', 25);
query1.fullOuterJoin(query2);

query1.toString = (id == 1001 OR id == 1002) OR (age > 25)
@mrphu3074
Copy link
Owner

@gaboelnuevo I think your idea is similar to api join
Can you take a look at https://github.com/mrphu3074/realm-query#joinquery-realmquery-realmquery ?

@gaboelnuevo
Copy link
Author

gaboelnuevo commented Oct 1, 2018

Yes is similar but the two queries are wrapped with a OR .

The join function maybe can receive the type of join. What do you think?

@mrphu3074
Copy link
Owner

@gaboelnuevo I can update this api to support logic operator (OR|AND) and default is AND

function join(query, logicOp = 'AND') {
//
}

What do you think?

@gaboelnuevo
Copy link
Author

@mrphu3074 Sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants