-
Notifications
You must be signed in to change notification settings - Fork 552
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
feat(templates): use collections for map and remove multi index support #4094
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c1f8080
feat(templates): use collections for map
julienrbrt 2d26ed0
updates
julienrbrt 457c9f5
updates
julienrbrt 5795761
updates
julienrbrt f4957bc
Merge branch 'main' into julien/collections-map
julienrbrt 9f9360a
updates
julienrbrt 40515a7
updates
julienrbrt 59ec2c7
add better error
julienrbrt 5278210
Merge branch 'main' into julien/collections-map
julienrbrt b543f9a
updates
julienrbrt 80dada5
Merge branch 'main' into julien/collections-map
julienrbrt 9e2f757
updates
julienrbrt 19248d2
updates
julienrbrt 9cd24ab
Merge branch 'main' into julien/collections-map
julienrbrt 0c8b513
Merge branch 'main' into julien/collections-map
julienrbrt 9d873c0
updates
julienrbrt d7b08a0
Merge branch 'main' into julien/collections-map
julienrbrt 579e8c1
feedback
julienrbrt 4a370ac
Merge branch 'main' into julien/collections-map
julienrbrt ef3292c
extract method
julienrbrt 90264ef
Merge branch 'main' into julien/collections-map
Pantani bc42274
Merge branch 'main' into julien/collections-map
julienrbrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 0 additions & 70 deletions
70
ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush
This file was deleted.
Oops, something went wrong.
23 changes: 3 additions & 20 deletions
23
ignite/templates/typed/map/files/component/x/{{moduleName}}/types/key_{{typeName}}.go.plush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,6 @@ | ||
package types | ||
|
||
import "encoding/binary" | ||
import "cosmossdk.io/collections" | ||
|
||
var _ binary.ByteOrder | ||
|
||
const ( | ||
// <%= TypeName.UpperCamel %>KeyPrefix is the prefix to retrieve all <%= TypeName.UpperCamel %> | ||
<%= TypeName.UpperCamel %>KeyPrefix = "<%= TypeName.UpperCamel %>/value/" | ||
) | ||
|
||
// <%= TypeName.UpperCamel %>Key returns the store key to retrieve a <%= TypeName.UpperCamel %> from the index fields | ||
func <%= TypeName.UpperCamel %>Key( | ||
<%= for (i, index) in Indexes { %><%= index.Name.LowerCamel %> <%= index.DataType() %>, | ||
<% } %>) []byte { | ||
var key []byte | ||
<%= for (i, index) in Indexes { %> | ||
<%= index.ToBytes(index.Name.LowerCamel) %> | ||
key = append(key, <%= index.Name.LowerCamel %>Bytes...) | ||
key = append(key, []byte("/")...) | ||
<% } %> | ||
return key | ||
} | ||
// <%= TypeName.UpperCamel %>Key is the prefix to retrieve all <%= TypeName.UpperCamel %> | ||
var <%= TypeName.UpperCamel %>Key = collections.NewPrefix("<%= TypeName.UpperCamel %>/value/") |
10 changes: 5 additions & 5 deletions
10
...yped/map/files/component/{{protoDir}}/{{appName}}/{{moduleName}}/{{typeName}}.proto.plush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
syntax = "proto3"; | ||
package <%= protoPkgName %>; | ||
|
||
option go_package = "<%= ModulePath %>/x/<%= ModuleName %>/types";<%= for (importName) in mergeCustomImports(Fields, Indexes) { %> | ||
option go_package = "<%= ModulePath %>/x/<%= ModuleName %>/types";<%= for (importName) in appendFieldsAndMergeCustomImports(Index, Fields) { %> | ||
import "<%= AppName %>/<%= ModuleName %>/<%= importName %>.proto"; <% } %><%= for (importName) in mergeProtoImports(Fields) { %> | ||
import "<%= importName %>"; <% } %> | ||
|
||
message <%= TypeName.UpperCamel %> {<%= for (i, index) in Indexes { %> | ||
<%= index.ProtoType(i+1) %>; <% } %><%= for (i, field) in Fields { %> | ||
<%= field.ProtoType(i+1+len(Indexes)) %>; <% } %> | ||
<%= if (!NoMessage) { %>string <%= MsgSigner.LowerCamel %> = <%= len(Fields)+len(Indexes)+1 %>;<% } %> | ||
message <%= TypeName.UpperCamel %> { | ||
<%= Index.ProtoType(1) %>; <%= for (i, field) in Fields { %> | ||
<%= field.ProtoType(i+2) %>; <% } %> | ||
<%= if (!NoMessage) { %>string <%= MsgSigner.LowerCamel %> = <%= len(Fields)+2 %>;<% } %> | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.