Last active
August 23, 2018 00:34
-
-
Save shadowcodex/587cd0ffbf49cefd3a00a56caf7a5f11 to your computer and use it in GitHub Desktop.
Revisions
-
shadowcodex revised this gist
Aug 23, 2018 . 1 changed file with 7 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,17 +3,11 @@ const { Prisma } = require("prisma-binding"); const prisma = new Prisma({ typeDefs: "./../generated/prisma.graphql", endpoint: "http://localhost:4466", }); const handleIty = async (iterator, callback) => { while (true) { await iterator .next() .then(value => { callback(null, value.value); @@ -32,9 +26,12 @@ const handleValue = async (error, value) => { console.log(value); }; const run = async () => { const ity = await prisma.subscription.user({}, "{ node { id } }").catch(err => { console.log("error:", err); return; }); handleIty(ity, handleValue); }; run(); -
shadowcodex created this gist
Aug 23, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ const { Prisma } = require("prisma-binding"); const prisma = new Prisma({ typeDefs: "./../generated/prisma.graphql", endpoint: "http://localhost:4466", // debug: true, }); const handleIty = async (iterator, callback) => { const ity = await iterator.catch(error => { callback(error, null); return; }); // console.log(ity); while (true) { await ity .next() .then(value => { callback(null, value.value); }) .catch(err => { callback(err, null); }); } }; const handleValue = async (error, value) => { if (error) { console.log(error); return; } console.log(value); }; const run = async () => { //console.log(await prisma.query.users({}, "{ id }")); handleIty(prisma.subscription.user({}, "{ node { id } }"), handleValue); }; run();