-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61ecd39
commit 06d3990
Showing
35 changed files
with
456 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* This example shows how to write GraphQL aliases in the TypeScript interface. | ||
*/ | ||
|
||
import { Pokemon } from '../$/generated-clients/pokemon/__.js' | ||
import { showJson } from '../$/helpers.js' | ||
|
||
const pokemon = Pokemon.create() | ||
|
||
const day = 1000 * 60 * 60 * 24 | ||
const year = day * 365.25 | ||
const yearsAgo100 = new Date(Date.now() - year * 100).getTime() | ||
const yearsAgo1 = new Date(Date.now() - year).getTime() | ||
|
||
const pokemons = await pokemon.query.$batch({ | ||
pokemons: [ | ||
[`elderPokemons`, { | ||
$: { filter: { birthday: { lte: yearsAgo100 } } }, | ||
name: true, | ||
}], | ||
[`babyPokemons`, { | ||
$: { filter: { birthday: { gte: yearsAgo1 } } }, | ||
name: true, | ||
}], | ||
], | ||
}) | ||
|
||
showJson(pokemons) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
examples/__outputs__/55_generated/generated_alias__alias.output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
---------------------------------------- SHOW ---------------------------------------- | ||
{ | ||
"elderPokemons": [ | ||
{ | ||
"name": "Pikachu" | ||
}, | ||
{ | ||
"name": "Squirtle" | ||
} | ||
], | ||
"babyPokemons": [ | ||
{ | ||
"name": "Charizard" | ||
} | ||
] | ||
} |
Oops, something went wrong.