-
Notifications
You must be signed in to change notification settings - Fork 277
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 extensions to access type modifiers #684
Allow extensions to access type modifiers #684
Conversation
acf6a62
to
f85f28c
Compare
94f85ad
to
f5c8b29
Compare
the failure on one of the jobs seems to be intermittent and happening on the main branch as well. i'll take a look to see if i can fix it but the PR itself is ok to review |
@greg-rychlewski there is another approach which we can take here, which is to say match on Btw, does this also work if you have an array of timestamps? Can we forward the mod information down? |
This sounds like a nice option to me. I will try it out in its own commit so we can take a look and revert it if it's no good.
Thankfully yes. Even though we only get the modifier for the array type, Postgres makes it the same as the sub- type. I added a test for it here: https://github.com/elixir-ecto/postgrex/pull/684/files#diff-dbb00c889130c35f21ecd6d123b9dc135fc6b1478fefb50fada337914e4ef94bR1773 For other super types this doesn't seem to be the case. Ranges and Records do not have any information about the sub type modifiers. |
@josevalim I gave it a shot two ways:
If there is a way to clean up the |
You can add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great to me! The only question is if we want to use a name more specific than mod
, but we can decide this once we expose it to users.
Closes #676
The main idea is:
nil
for things like tuples where they don't care about the modifier. So that the different arity functions are preserved.I only applied to changes for
timestamp
but I can do it for the other time related extensions if this seems like a good idea.