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

Use String as id for Storable #78

Merged
merged 3 commits into from
Jul 2, 2016
Merged

Use String as id for Storable #78

merged 3 commits into from
Jul 2, 2016

Conversation

MP0w
Copy link
Member

@MP0w MP0w commented Jul 1, 2016

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)

@codecov-io
Copy link

codecov-io commented Jul 2, 2016

Current coverage is 98.39%

Merging #78 into master will not change coverage

@@             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          

Sunburst

Powered by Codecov. Last updated by d7a7fb2...dfe7f00

@MP0w
Copy link
Member Author

MP0w commented Jul 2, 2016

Will merge it for the moment as I need the changes, we cans till discuss later and eventually revert if you don't agree.

@MP0w MP0w merged commit e53e4de into master Jul 2, 2016
@MP0w MP0w deleted the feature/StringId branch July 2, 2016 16:19
// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assume

Copy link
Member

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.

@joanromano
Copy link
Member

👍

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.

3 participants