Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow structs to implement access #3

Merged

Conversation

drtheuns-enreach
Copy link
Contributor

To keep compatibility with the old implementation, the dsl_struct has been changed to do the string->atom key conversion in all of the access functions. The only difference now should be that an unknown struct key being assigned to the struct will result in a string key being added to the map. For example:

defmodule Obj do
  use DslStruct, key: nil
end

# pseudo; assume access protocol
obj = %Obj{}
obj["key"] = 5
obj.key == 5

obj["unknown"] = 6 # AutoMap would have ignored this key
obj["unknown"] == 6

@arjan arjan merged commit de905e4 into botsquad:master Apr 17, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants