root_type(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gqlValue result, int depth) {
    gqlValue		na = gql_extract_arg(err, field, sel, "name");
    const char		*name = NULL;
    const char		*key = sel->name;
    int			d2 = depth + 1;
    gqlType		type;
    gqlValue		co;
    struct _gqlCobj	child = { .clas = &type_class };

    if (NULL != na) {
	name = gql_string_get(na);
    }
    if (NULL == name) {
	return agoo_err_set(err, AGOO_ERR_ARG, "%s field requires a name argument. %s:%d", sel->name, __FILE__, __LINE__);
    }
    if (NULL == (type = gql_type_get(name))) {
	return agoo_err_set(err, AGOO_ERR_ARG, "%s is not a defined type. %s:%d", name, __FILE__, __LINE__);
    }
    if (NULL != sel->alias) {
	key = sel->alias;
    }
    if (NULL == (co = gql_object_create(err)) ||
	AGOO_ERR_OK != gql_object_set(err, result, key, co)) {
	return err->code;
    }
    child.ptr = type;
    if (AGOO_ERR_OK != gql_eval_sels(err, doc, (gqlRef)&child, field, sel->sels, co, d2)) {
	return err->code;
    }
    return AGOO_ERR_OK;
}
root_type(agooErr err, gqlDoc doc, gqlCobj obj, gqlField field, gqlSel sel, gqlValue result, int depth) {
    gqlValue		na = gql_extract_arg(err, field, sel, "name");
    const char		*name = NULL;
    const char		*key = sel->name;
    int			d2 = depth + 1;
    gqlType		type;
    gqlValue		co;
    struct _gqlCobj	child = { .clas = &type_class };

    if (NULL != na) {
	name = gql_string_get(na);
    }
    if (NULL == name) {
	return agoo_err_set(err, AGOO_ERR_ARG, "%s field requires a name argument. %s:%d", sel->name, __FILE__, __LINE__);
    }
    if (NULL == (type = gql_type_get(name))) {
	return agoo_err_set(err, AGOO_ERR_ARG, "%s is not a defined type. %s:%d", name, __FILE__, __LINE__);
    }
    if (NULL != sel->alias) {
	key = sel->alias;
    }
    if (NULL == (co = gql_object_create(err)) ||
	AGOO_ERR_OK != gql_object_set(err, result, key, co)) {
	return err->code;
    }
    child.ptr = type;
    if (AGOO_ERR_OK != gql_eval_sels(err, doc, (gqlRef)&child, field, sel->sels, co, d2)) {
	return err->code;
    }
    return AGOO_ERR_OK;
}