当您尝试通过 Docker 安装 ArangoDB 时:
docker run -e ARANGO_ROOT_PASSWORD=password -p 8529:8529 -d --name arangodb arangodb
抛出以下错误:
Unable to find image 'arangodb:latest' locally
latest: Pulling from library/arangodb
docker: no matching manifest for linux/arm64/v8 in the manifest list entries.
See 'docker run --help'.
Run Code Online (Sandbox Code Playgroud) 给定以下 JsonValue:
let mut schema = json!({
"level": "strict",
"rule": {}
});
Run Code Online (Sandbox Code Playgroud)
我们将动态地将值插入到此 JsonValue 中
let value: json!({
"type": property.r#type,
"minLength": property.min_length,
"maxLength": property.max_length,
"enum": property.r#enum
});
schema["rule"]
.as_object_mut()
.unwrap()
.insert(
String::from(property.name),
value
);
// Struct for Property
#[derive(Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SchemaDocumentProperty
{
pub name: String,
pub r#type: Option<String>,
pub min_length: Option<u32>,
pub max_length: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub r#enum: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub items: Option<SchemaDocumentPropertyArray>
}
Run Code Online (Sandbox Code Playgroud)
当前输出如下,其中minLength、maxLength和enum均为 …
例:
var i = 'Hello \n World'
console.log(i)
Run Code Online (Sandbox Code Playgroud)
会回来:
Hello
World
Run Code Online (Sandbox Code Playgroud)
而且我希望它返回
Hello \n World
Run Code Online (Sandbox Code Playgroud)
不渲染新行,因为我打算将其存储在数据库中.
对于那些想要在数据库中存储的人
您不需要转义,因为您的文档数据库将执行JSON.strigify,我使用ArangoDB并且它工作得非常好,感谢@PaulPro