Skip to content

Instantly share code, notes, and snippets.

@bbakerman
Created September 1, 2017 06:29
Show Gist options
  • Save bbakerman/2d7297a31effc60586ab6bd68d9cf9c9 to your computer and use it in GitHub Desktop.
Save bbakerman/2d7297a31effc60586ab6bd68d9cf9c9 to your computer and use it in GitHub Desktop.
DataFetcher userDataFetcher = new DataFetcher() {
@Override
public Object get(DataFetchingEnvironment environment) {
CompletableFuture<User> userPromise = CompletableFuture.supplyAsync(
() -> {
return fetchUserFromDatabase(environment.getArgument("userId"));
});
return userPromise;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment