Conversation
fadeev
left a comment
There was a problem hiding this comment.
Code generation looks good! 👍
| import "gogoproto/gogo.proto"; | ||
|
|
||
| message <%= title(TypeName) %> { | ||
| string index = 2;<%= for (i, field) in Fields { %> |
There was a problem hiding this comment.
| string index = 2;<%= for (i, field) in Fields { %> | |
| string index = 1;<%= for (i, field) in Fields { %> |
Not blocking.
There was a problem hiding this comment.
We don't have a creator field here anymore, is it fine to not have it?
There was a problem hiding this comment.
Also, what if instead of creating a new message type, can't we have an option in the existent one that enables indexing with the user given string instead? By default indexing is disabled.
This feels like will simplify our code generation logic and can be more obvious for the user.
There was a problem hiding this comment.
For now the type is only managed internally, you may have no creator, it's up to the developer to decide. For example, in the IBC exchange, you will have an OrderBook which is indexed by PortID*ChannelId*TokenPair you don't have creator for this one.
Also, what if instead of creating a new message type, can't we have an option in the existent one that enables indexing with the user given string instead? By default indexing is disabled.
Indexed type respond to a different logic, methods are a bit different than the other type. And you have less method generated. Also we don't know how those two kind of type will evolve in the future. We need a different template for better maintainability.
* Rename placeholder vars * Refactoir add type options * Template * Scaffold file modification * Implement get all * Indexed flag * Integration tests * Fix bugds * Lint * Fix getAll issue Co-authored-by: İlker G. Öztürk <ilkergoktugozturk@gmail.com>
starport type foo bar ... --indexedcreates a type that is indexed by a string. Methods to set and get this type in the store are scaffoldedQueries to get the type instances are created:
list-foo,show-foo <index>The type can only be created internally. Messages to set and remove instances will be implemented in another PR.
Since there are no messages to add types, the app can be tested by adding types in
InitGenesis: