我尝试在安装了Docker 1.11.0的运行CentOS 7.2.1的本地流浪汉机器上安装New Relic Servers for Linux.我按照步骤为Docker启用了Linux服务器,所有正在运行的容器都显示在New Relic Server页面中,但CPU和内存使用情况为空.我也按照指南启用内存使用指标,但仍然没有运气(https://docs.newrelic.com/docs/servers/new-relic-servers-linux/installation-configuration/enabling-new-relic-servers-docker #enable-memory-usage).
我错过了什么吗?为什么它不起作用的任何线索?
我安装了 nodejs 和 npm。
但现在我想更新到最新版本,我尝试了很多方法但都没有奏效。
我应该期望枚举类型自动解析还是仅存在类型以限制选项?
给定以下 GraphQL Schema:
type Job {
description: String!
status: Status!
}
enum Status {
PENDING_REVIEW
PENDING_APPROVAL
APPROVED
}
Run Code Online (Sandbox Code Playgroud)
和一个看起来像这样的查询:
query job {
description
status
}
Run Code Online (Sandbox Code Playgroud)
如果我的数据库返回以下内容:
{ "description": "Some irrelevant job description", "status": 1 }
Run Code Online (Sandbox Code Playgroud)
我希望 GraphQL 返回:
{ "description": "Some irrelevant job description", "status": "PENDING_APPROVAL" }
Run Code Online (Sandbox Code Playgroud)
我是否设置错误,或者这种预期行为是否需要我为 status
const getQuestionStatus = ({ status }) => ['PENDING_REVIEW', 'PENDING_APPROVAL', 'APPROVED'][status];
Run Code Online (Sandbox Code Playgroud) 只是好奇PHP类型转换如何适用于这种情况.
var_dump(1 == '1,2') // boolean(true)
Run Code Online (Sandbox Code Playgroud) 使用纯graphql实现,我们可以从字符串运行查询,如下所示:
var { graphql, buildSchema } = require('graphql');
var schema = buildSchema(`
type Query {
hello: String
}
`);
var root = { hello: () => 'Hello world!' };
graphql(schema, '{ hello }', root).then((response) => {
console.log(response);
});
Run Code Online (Sandbox Code Playgroud)
但是在ApolloServer中找不到相同的方法:
const server = new ApolloServer({ typeDefs, resolvers });
// something like this
server.runQuery('{ hello }');
Run Code Online (Sandbox Code Playgroud)