Skip to content

Commit

Permalink
Update groupby
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhduong committed Apr 23, 2018
1 parent 9c39b92 commit a446ab1
Show file tree
Hide file tree
Showing 9 changed files with 5,007 additions and 273 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ main();
- [x] takeWhile
- [x] skip
- [x] skipWhile
- [ ] groupBy
- [x] groupBy
- [ ] distinct
- [ ] concat
- [ ] zip
Expand Down
41 changes: 41 additions & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Queryable } from '../dist/out-tsc/index.js';

const queryable = new Queryable();

let promiseApi = new Promise((resolve, reject) => {
// Fake data from api
setTimeout(() => {
console.log('...get data');
resolve([
{ name: 'Ronaldo', overall: 96, nationId: 1, skills: [97, 90, 86, 95] },
{ name: 'Messi', overall: 98, nationId: 2, skills: [97, 90, 86, 95] },
{ name: 'Mbappe', overall: 86, nationId: 3, skills: [97, 90, 86, 95] },
{ name: 'Salah', overall: 89, nationId: 4, skills: [97, 90, 86, 95] }
]);
}, 1000);
})

let staticLoopkup = [
{ id: 1, name: 'Portugal', areaId: 1 },
{ id: 2, name: 'Argentina', areaId: 2 },
{ id: 3, name: 'France', areaId: 1 },
{ id: 4, name: 'Egypt', areaId: 3 }
]

let staticAreas = [
{ id: 1, areaName: 'Euro' },
{ id: 2, areaName: 'South America' },
]

async function main() {
// Just query not execute query
let query = queryable
.from(promiseApi)
.where(x => x.overall > 90)
.selectMany(x => x.skills);

const data = await query.toList();
console.log(data);
}

main();
Loading

0 comments on commit a446ab1

Please sign in to comment.