Fork me on GitHub
#graphql
<
2018-08-22
>
myguidingstar02:08:33

@tbaldridge maybe you would want to parse Graphql to output to something that Pathom can consume https://github.com/wilkerlucio/pathom

myguidingstar02:08:10

by something I mean om.next query format

myguidingstar02:08:23

the library provides quite a few tools for caching due to its use of clojure data structure

myguidingstar02:08:56

for parsing graphql only, you can use this library https://github.com/alumbra/alumbra.parser

hlship19:08:50

@tbaldridge Yes, GraphQL supports parameterized queries (http://facebook.github.io/graphql/June2018/#sec-Validation.Variables). Lacinia fully supports this as well. In Lacinia, step one is to parse the GraphQL document into Lacinia's internal representation. Step two is to apply variables. Step three is to execute the query and generate results.

hlship19:08:30

You can cache (in memory) the internal representation from step one. This shaves a small amount of time off of overall request processing time (even large queries can be parsed in maybe 2 ms).

hlship19:08:39

One thing in the works for lacinia-pedestal is support for server-side queries, where the client sends the name of a query document, and the document exists on the server, and the standard interceptor stack does the exact kind of caching we're talking about.

hlship19:08:32

I'm hopeful that using pre-parsed queries will not only cut down on the parse time (those 1 or 2 ms) but significantly cut down on memory thrash .... there's an awful lot of strings and maps and such when parsing!