You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm coming from go and was looking for something similar to boltdb.
After finding your project and starting to learn rust, I wanted to ask if it would be feasible to implement the typestate pattern for transactions.
Instead of just allowing to call tx() with a bool you could also call ro() or rw() which would give a transaction without any of the write functions even available. That way you could catch these errors at compiler time.
If you think this is a good idea, I'd be happy to do a bit of gruntwork for adding the state to each neccesary type.
I don't think I can handle all problems however, so I'd be grateful for some help later on.
I would suggest these 3 TypeStates:
Legacy (would be used when tx is called)
ReadOnly
WriteOnly
This way other projects will still function, while enabling compiler type checking the transaction type.
The text was updated successfully, but these errors were encountered:
Hi,
I'm coming from go and was looking for something similar to boltdb.
After finding your project and starting to learn rust, I wanted to ask if it would be feasible to implement the typestate pattern for transactions.
Instead of just allowing to call tx() with a bool you could also call ro() or rw() which would give a transaction without any of the write functions even available. That way you could catch these errors at compiler time.
If you think this is a good idea, I'd be happy to do a bit of gruntwork for adding the state to each neccesary type.
I don't think I can handle all problems however, so I'd be grateful for some help later on.
I would suggest these 3 TypeStates:
This way other projects will still function, while enabling compiler type checking the transaction type.
The text was updated successfully, but these errors were encountered: