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

Provide a mechanism to use Repository<Void, C> #6

Open
SpicyCactuar opened this issue Jul 25, 2017 · 1 comment
Open

Provide a mechanism to use Repository<Void, C> #6

SpicyCactuar opened this issue Jul 25, 2017 · 1 comment
Assignees

Comments

@SpicyCactuar
Copy link
Contributor

SpicyCactuar commented Jul 25, 2017

Summary

Sometimes a user may want to make a change to data locally or in API, but the 'response' contains no data.

The issue is the following:

  • User instantiates a Repository<Void, C>.
  • It has to provide a QueryStrategy<Void, C>.
  • QueryStrategy#read would return Void.
  • It can't return null since Repository would interpret it as a cache miss. Void cannot be instantiated.
  • The user is forced to return something, Object for example. In consequence, it's forced to change the Call type parameter from Void to Object yielding a Call<Void>.
@SpicyCactuar
Copy link
Contributor Author

One solution i came up with was having a Transaction<T>, Operation<T> or something similar that holds, at least, the following data:

  • Whether the operation was a hit or a miss. Let's call it status for now.
  • The data yielded by said operation, if any. Let's call it data for now.

This way, we check the status instead of the data.

What do you think @juanignaciomolina ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants