parse_query_vars(agooErr err, const char *var_json, int vlen) {
    gqlValue	vlist = NULL;
    gqlLink	link;
    gqlVar	vars = NULL;

    vlen = agoo_req_query_decode((char*)var_json, vlen);
    if (NULL == (vlist = gql_json_parse(err, var_json, vlen))) {
	goto DONE;
    }
    if (GQL_SCALAR_OBJECT != vlist->type->scalar_kind) {
	agoo_err_set(err, AGOO_ERR_EVAL, "expected variables to be an object.");
	goto DONE;
    }
    for (link = vlist->members; NULL != link; link = link->next) {
	gqlVar	v = gql_op_var_create(err, link->key, link->value->type, link->value);

	link->value = NULL;
	if (NULL == v) {
	    goto DONE;
	}
	v->next = vars;
	vars = v;
    }
DONE:
    if (NULL != vlist) {
	gql_value_destroy(vlist);
    }
    return vars;
}
parse_query_vars(agooErr err, const char *var_json, int vlen) {
    gqlValue	vlist = NULL;
    gqlLink	link;
    gqlVar	vars = NULL;

    vlen = agoo_req_query_decode((char*)var_json, vlen);
    if (NULL == (vlist = gql_json_parse(err, var_json, vlen))) {
	goto DONE;
    }
    if (GQL_SCALAR_OBJECT != vlist->type->scalar_kind) {
	agoo_err_set(err, AGOO_ERR_EVAL, "expected variables to be an object.");
	goto DONE;
    }
    for (link = vlist->members; NULL != link; link = link->next) {
	gqlVar	v = gql_op_var_create(err, link->key, link->value->type, link->value);

	link->value = NULL;
	if (NULL == v) {
	    goto DONE;
	}
	v->next = vars;
	vars = v;
    }
DONE:
    if (NULL != vlist) {
	gql_value_destroy(vlist);
    }
    return vars;
}