GraphQL response deduplicator.
Javascript version: https://github.com/gajus/graphql-deduplicator
package main
import (
"log"
"github.com/riskimidiw/gqldeduplicator"
)
func main() {
data := []byte(`
{
"root": [
{
"__typename": "foo",
"id": 1,
"name": "foo"
},
{
"__typename": "foo",
"id": 1,
"name": "foo"
}
]
}`)
deflate, err := gqldeduplicator.Deflate(data)
if err != nil {
log.Fatal(err)
}
log.Println("deflate:", string(deflate))
inflate, err := gqldeduplicator.Inflate(deflate)
if err != nil {
log.Fatal(err)
}
log.Println("inflate:", string(inflate))
}