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

[PLATFORM-543] Refactor Rolodex.Schema.field/3 macro #42

Merged
merged 1 commit into from
May 6, 2019

Conversation

bceskavich
Copy link
Contributor

Rather than define a bunch of __field__/1 functions on the caller
module as the field/3 macro is invoked, we only collect field
definition metadata in an accumulator attribute. Later, we serialize
the field definitions together into a formatted map on demand via
__schema__(:fields).

This change will allow users to define fields on their schemas in
for comprehensions or maps, without any compiler warnings about
unmatchable function heads.

Rather than define a bunch of `__field__/1` functions on the caller
module as the `field/3` macro is invoked, we only collect field
definition metadata in an accumulator attribute. Later, we serialize
the field definitions together into a formatted map on demand via
`__schema__(:fields)`.

This change will allow users to define fields on their schemas in
for comprehensions or maps, without any compiler warnings about
unmatchable function heads.
@bceskavich bceskavich requested a review from sjkaliski May 6, 2019 13:42
@bceskavich bceskavich merged commit 7888a08 into develop May 6, 2019
@bceskavich bceskavich deleted the bc-schema-field-macro-refactor branch May 6, 2019 17:48
bceskavich added a commit that referenced this pull request May 6, 2019
Rather than define a bunch of `__field__/1` functions on the caller
module as the `field/3` macro is invoked, we only collect field
definition metadata in an accumulator attribute. Later, we serialize
the field definitions together into a formatted map on demand via
`__schema__(:fields)`.

This change will allow users to define fields on their schemas in
for comprehensions or maps, without any compiler warnings about
unmatchable function heads.
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.

2 participants