Reference

get map

Test whether an input matches an entry in a map file.

Description Jump to heading

This command returns a result that indicates whether an input matches an entry in a map file. This is useful for debugging maps.

Examples Jump to heading

Pass the map ID and an input string to get map to test whether the string matches any keys.

nix
/cart/ cart_api
/reviews/ reviews_api
nix
/cart/ cart_api
/reviews/ reviews_api

Assume we have this map file:

Test whether the input string /reviews/war-and-peace/1 matches any keys:

nix
echo "get map #0 /reviews/war-and-peace/1" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "get map #0 /reviews/war-and-peace/1" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
output
text
type=beg, case=sensitive, found=yes, idx=tree, key="/reviews/", value="reviews_api", type="str"
output
text
type=beg, case=sensitive, found=yes, idx=tree, key="/reviews/", value="reviews_api", type="str"

The result indicates that a match was found using the type beg, which means begins with. It matched the key /reviews/.

See also Jump to heading

Do you have any suggestions on how we can improve the content of this page?