Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #42096 from DelazJ/mapsFunctions
improvements fixes to Maps functions
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Mar 8, 2021
1 parent 32a6ee9 commit 8f3bb33
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/function_help/json/from_json
Expand Up @@ -6,7 +6,7 @@
"arguments": [
{"arg":"string", "description":"JSON string"}],
"examples": [
{"expression":"from_json('{\"qgis\":\"rocks\"}')", "returns":"{ \"qgis\" : \"rocks\" }"},
{"expression":"from_json('{\"qgis\":\"rocks\"}')", "returns":"{ 'qgis': 'rocks' }"},
{"expression":"from_json('[1,2,3]')", "returns":"[1,2,3]"}
]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/hstore_to_map
Expand Up @@ -5,6 +5,6 @@
"description": "Creates a map from a hstore-formatted string.",
"arguments": [
{"arg":"string", "description":"the input string"}],
"examples": [ { "expression":"hstore_to_map('qgis=>rocks')", "returns":"{ \"qgis\" : \"rocks\" }"}
"examples": [ { "expression":"hstore_to_map('qgis=>rocks')", "returns":"{ 'qgis': 'rocks' }"}
]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/json_to_map
Expand Up @@ -5,6 +5,6 @@
"description": "Creates a map from a json-formatted string.",
"arguments": [
{"arg":"string", "description":"the input string"}],
"examples": [ { "expression":"json_to_map('{\"qgis\":\"rocks\"}')", "returns":"{ \"qgis\" : \"rocks\" }"}
"examples": [ { "expression":"json_to_map('{\"qgis\":\"rocks\"}')", "returns":"{ 'qgis': 'rocks' }"}
]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/map_concat
Expand Up @@ -8,6 +8,6 @@
{"arg":"map1", "syntaxOnly": true},
{"arg":"map2", "syntaxOnly": true},
{"arg":"map", "descOnly": true, "description":"a map"}],
"examples": [ { "expression":"map_concat(map('1','one', '2','overridden'),map('2','two', '3','three'))", "returns":"{ '1': 'one, '2': 'two', '3': 'three' }"}
"examples": [ { "expression":"map_concat(map('1','one', '2','overridden'),map('2','two', '3','three'))", "returns":"{ '1': 'one', '2': 'two', '3': 'three' }"}
]
}
4 changes: 2 additions & 2 deletions resources/function_help/json/map_get
Expand Up @@ -2,10 +2,10 @@
"name": "map_get",
"type": "function",
"groups": ["Maps"],
"description": "Returns the value of a map, given it's key.",
"description": "Returns the value of a map, given its key. Returns NULL if the key does not exist.",
"arguments": [ {"arg":"map","description":"a map"},
{"arg":"key","description":"the key to lookup"}],
"examples": [ { "expression":"map_get(map('1','one','2','two'),'2')", "returns":"'two'"},
{ "expression":"map_get( item_variables('Map 0'), 'map_scale')", "returns":"scale of the item 'Map 0' in the current print layout"}
{ "expression":"map_get( item_variables('Map 0'), 'map_scale')", "returns":"scale of the item 'Map 0' (if it exists) in the current print layout"}
]
}
6 changes: 4 additions & 2 deletions resources/function_help/json/map_insert
Expand Up @@ -2,9 +2,11 @@
"name": "map_insert",
"type": "function",
"groups": ["Maps"],
"description": "Returns a map with an added key/value.",
"description": "Returns a map with an added key/value. If the key already exists, its value is overridden.",
"arguments": [ {"arg":"map","description":"a map"},
{"arg":"key","description":"the key to add"},
{"arg":"value","description":"the value to add"}],
"examples": [ { "expression":"map_insert(map('1','one'),'3','three')", "returns":"{ '1': 'one', '3': 'three' }"}]
"examples": [ { "expression":"map_insert(map('1','one'),'3','three')", "returns":"{ '1': 'one', '3': 'three' }"},
{ "expression":"map_insert(map('1','one','2','overridden'),'2','two')", "returns":"{ '1': 'one', '2': 'two' }"}
]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/map_to_hstore
Expand Up @@ -5,6 +5,6 @@
"description": "Merge map elements into a hstore-formatted string.",
"arguments": [
{"arg":"map", "description":"the input map"}],
"examples": [ { "expression":"map_to_hstore(map('qgis','rocks'))", "returns":"\"qgis\"=>\"rocks\"}"}
"examples": [ { "expression":"map_to_hstore(map('qgis','rocks'))", "returns":"'\"qgis\"=>\"rocks\"'"}
]
}

0 comments on commit 8f3bb33

Please sign in to comment.