-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
add re-usable Row<Model> class #12
Conversation
let galaxies = db.query(Galaxy.self).filter(\.name == "Milky Way").all()
print(galaxies) // [Instance<Galaxy>] Should that be |
@twof oops, yeah I forgot |
With this setup, are we at risk of people using and creating initializers? Is a raw |
@twof yes, it's possible people can call |
Seems like feedback on this change is mostly positive. Given that the changes here would likely be a requirement to supporting |
Hey @tanner0101, you just merged a pull request, have a coin! You now have 1154 coins. |
As discussed in #11, here is a proof of concept of a generic
Row
type. This allows for models to just declare their unique schema, without needing to re-implement the bare-bones of a model.Before
Before the change, properties were declared in a nested
Model.Properties
struct.After
After the change, the model is the properties struct. A method
new()
is available to create aRow<Model>
.Note on dynamic KeyPath lookup
With Pitch: Key-Path Member Lookup possibly coming to Swift in the future, this change would allow us to declare
Row
as@keyPathMemberLookup
and get back normal dot-syntax:Naming
I'm up for any ideas on how to spell
Row
andModel.default
. Some other ideas I have:Row:
Model.default