-
-
Save johnfoconnor/51316bc82bd6e89a9b9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_app.complex_list.buzz.type = person | |
my_app.complex_list.buzz.age = 25 | |
my_app.complex_list.fido.type = dog | |
my_app.complex_list.fido.opts.special_value = biz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mappings: [ | |
"my_app.complex_list.*": [ | |
to: "my_app.complex_list", | |
datatype: [:complex], | |
default: [] | |
] | |
"my_app.complex_list.*.opts.special_value": [ | |
to: "my_app.complex_list", | |
datatype: :atom, | |
default: :bar | |
], | |
"my_app.complex_list.*.type" [ | |
to: "my_app.complex_list", | |
datatype: :atom, | |
default: :undefined | |
], | |
"my_app.complex_list.*.age" [ | |
to: "my_app.complex_list", | |
datatype: :integer, | |
default: 0 | |
]] | |
translations: [ | |
"my_app.complex_list.*": fn | |
_, {key, value_map}, acc -> | |
# example values | |
# {buzz, %{type: :person, age: 25, opts: %{special_value: :bar}}} | |
# {fido, %{type: :dog, age: 0, opts: %{special_value: :biz}}} | |
acc -> [[name: name, | |
type: value_map[:type], | |
age: value_map[:age], | |
opts: [special_value: value_map[:opts][:special_value]] | |
] | acc] | |
]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{my_app, | |
complex_list, [ | |
[{name, buzz}, | |
{type, person}, | |
{age, 25}, | |
{opts, [{special_value, bar}]}, | |
], | |
[{name, fido}, | |
{type, dog}, | |
{age, 0}, | |
{opts, [{special_value, biz}]} | |
] | |
]} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment