# coding=utf-8
from __future__ import absolute_import, unicode_literals, print_function

from .schema import schema
from gmgql import execute
from rpc.decorators import bind


def graphql_view(query, variables=None):
    res = execute(schema, request_string=query, variable_values=variables)
    if not res.errors:
        return res.data

bind('gql/execute')(graphql_view)
