graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Support for Marshal?

Open bibstha opened this issue 6 years ago • 0 comments

After executing a query, the result is an anonymous class with Schema::ObjectClass as an ancestor. To prevent from fetching the resource multiple times, ideally it would be nice to store it in a cache for example:

result = Rails.cache.fetch('some-key') do
  client.query(SomeQuery, variables: { })
end

However since this is an anonymous class, it's not possible to Marshal it. I can convert it into a Hash to_h but I lose the convenience of accessing values as result: result.some_type vs result["some_type"].

Thoughts?

bibstha avatar Oct 15 '19 16:10 bibstha