-
Notifications
You must be signed in to change notification settings - Fork 44
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
Use String as id for Storable #78
Conversation
Current coverage is 98.39%@@ master #78 diff @@
==========================================
Files 9 9
Lines 435 435
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 428 428
Misses 7 7
Partials 0 0
|
Will merge it for the moment as I need the changes, we cans till discuss later and eventually revert if you don't agree. |
// TODO: default to String and create a protocol that as an Int id with default implementation. Because String is not always convertible to Int but Int can always be converted to String. | ||
var id: Int { get } | ||
init(id: Int, db: KakapoDB) | ||
/// The unique identifier provided by `KakapoDB`, objects shouldn't generate ids themselves. `KakapoDB` generate `Int` ids converted to String for better compatibilities with standards like JSONAPI, in case you need `Int` ids is safe to ssume that the conversion will always succeeed. |
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.
assume
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.
I think we could provide an example with Int identifiers here.
👍 |
Closes #26
Rationale:
mpow [5:24 PM]
FYI just implemented id as String instead of Int otherwise JSONAPIEntity can't be easily Storable, the id generated by db will still be Int converted to String. This is better because Int is always convertible to string but not the other way around
(docu missing, waiting for merge of docu PR)