gpub_eval(agooErr err, gqlDoc query, gqlRef event) {
    agooText	t = NULL;
    gqlSel	sel;
    gqlValue	result;

    if (NULL == query->ops || NULL == query->ops->sels) {
	agoo_err_set(err, AGOO_ERR_TYPE, "subscription not valid");
	return NULL;
    }
    sel = query->ops->sels;
    if (NULL != (result = gql_object_create(err))) {
	struct _gqlField	field;

	memset(&field, 0, sizeof(field));
	field.type = sel->type;
	if (AGOO_ERR_OK != gql_eval_sels(err, query, event, &field, sel->sels, result, 0)) {
	    gql_value_destroy(result);
	    return NULL;
	}
	if (NULL == (t = agoo_text_allocate(1024))) {
	    AGOO_ERR_MEM(err, "Text");
	    return NULL;
	}
	t = gql_value_json(t, result, 0, 0);
	gql_value_destroy(result);
    }
    return t;
}
gpub_eval(agooErr err, gqlDoc query, gqlRef event) {
    agooText	t = NULL;
    gqlSel	sel;
    gqlValue	result;

    if (NULL == query->ops || NULL == query->ops->sels) {
	agoo_err_set(err, AGOO_ERR_TYPE, "subscription not valid");
	return NULL;
    }
    sel = query->ops->sels;
    if (NULL != (result = gql_object_create(err))) {
	struct _gqlField	field;

	memset(&field, 0, sizeof(field));
	field.type = sel->type;
	if (AGOO_ERR_OK != gql_eval_sels(err, query, event, &field, sel->sels, result, 0)) {
	    gql_value_destroy(result);
	    return NULL;
	}
	if (NULL == (t = agoo_text_allocate(1024))) {
	    AGOO_ERR_MEM(err, "Text");
	    return NULL;
	}
	t = gql_value_json(t, result, 0, 0);
	gql_value_destroy(result);
    }
    return t;
}