-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates): use collections for map and remove multi index suppo…
…rt (#4094)
- Loading branch information
1 parent
53573da
commit 1610734
Showing
22 changed files
with
287 additions
and
388 deletions.
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.