Add new builtin for merging maps
还没有人认领这个 Issue。
评估
调研方向
未指定文件或测试。先检查现有 builtins 如何处理 maps,以及 concat 的规范是什么,然后确定这应该是一个新的 merge/copy builtin,还是对 concat 的扩展。完成的标准是:issue 中的嵌套字段示例能够按照有文档说明的 merge 语义运行,并且测试覆盖该行为。
由索引模型根据 Issue 内容生成。
描述
Expr currently does not have a builtin for merging maps. Adding a new builtin would be useful to merge maps but also to modify nested fields.
For instance:
/*
Env:
{
"data":{
"status": 0,
"rows": 32,
"signing_keys":[
"key1",
"key2"
]
}
}
*/
merge($env["data"], {signing_keys: concat($env["data"]["signing_keys"], ["another"])})
/*
Output:
{
"data":{
"status": 0,
"rows": 32,
"signing_keys":[
"key1",
"key2",
"another"
]
}
}
*/
As for the name, "merge" seems natural but I would also consider using "copy" (as used in Go's maps package). Other possibility is to modify "concat" to support both arrays and maps.
- 主要语言
- Go
- 星标
- 8k
- 派生
- 535
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
expr-lang/expr 的其他 Issue
-
docs needed
难度 1/5 1-3 小时 新手友好度 62/100
-
难度 3/5 1-2 天 新手友好度 65/100
-
`find`, `findIndex`, `first` and `get` are type-checked as the element type where they return nil未关闭
难度 3/5 1-2 天 新手友好度 65/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 35/100
相似的 Issue
-
agent-butler-finding bug
难度 1/5 1 小时以内 新手友好度 94/100
jordansmall/spindrift#4367 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
kind/engineering pulumi/pulumi-terraform Task Workflow Failure
难度 2/5 1-3 小时 新手友好度 68/100
pulumi/pulumi-terraform#1215 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 88/100
githubnext/gh-aw-workshop#4132 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
JuliusBrussee/caveman#1177 · 1 条评论 ·
维护者通常 1 天内回复