-
Notifications
You must be signed in to change notification settings - Fork 6
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
Posexional row as struct #29
Conversation
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.
Amazing work, for real ❤️
Unfortunately, our CI service is purposely disabled for public projects, so it can't be run on this PR 😢
I've tried locally to run credo and dialyzer and I got a bunch of errors. You can try mix check
and see that credo complains about single pipes, and some other stuff.
Apart from that, I'm not a huge fan of having a Posexional.Field.Field
module, mostly for the repetition of words and because imho it's not that self-explanatory. Maybe something like TypedField
would be better? I like the reference to Ecto, but the repetition kills me :D
…stency on Posexional.Row.read/2. Fixed credo complains
Hey @neslinesli93, Thank you for your review! I've already tackled everything you pointed out! If you have anything more to add, please feel free to do it! :) |
Hi @GPrimola ! You have done a really great work here! Thank you for you contribution! I have run dialyzer locally (in the container) and there are still some issues (I count 9 of those). Let us know if you need help to solve them! We are glad to help! Thank you again! |
@GPrimola is it ready to be merged? |
Hey @chess4ever, thanks! Actually I missed letting dialyzer run fully. Thank you! |
Posexional row as struct (primait#29)
This is a proposal for #11.
Obs 1: There's no breaking changes.
Obs 2: I apologize about the size of this PR. 😅
Major Changes
[:as_struct]
toPosexionalRow.__using__/1
macro. Not breaking.Posexional.Field.Field
that parses field type text. It behaves likeEcto.Schema.field/3
. Not breaking.Examples
PosexionalRow.__using__/1
with option[:as_struct]
andPosexionalRow.field/4
with simple data types:Suppose we have the following row definition to be mapped to a struct:
and a positional file (example.txt - not included) with the content
row1123ABA00432.99falseJohn Doe
. ThenPosexionalRow.__using__/1
with option[:as_struct]
andPosexionalRow.field/4
with complex data types:If you want more information about the behaviour, you can check the
test/posexional/field/field_test.exs
file where there are examples of bad input and how it's been handled.Please, feel free to comment, propose changes, code refactor, variable, module, function and option naming, etc. I'll be glad to tackle everything!
Congrats about the lib, though! It's been very helpful! 😄