-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…4131) * feat(templates): add `CollectionsKeyValueName` to `field.DataType` * pr number * typo * imports Co-authored-by: Danilo Pantani <danpantani@gmail.com> * fix cache * feedback --------- Co-authored-by: Danilo Pantani <danpantani@gmail.com>
- Loading branch information
1 parent
def21e3
commit 4821e3e
Showing
13 changed files
with
117 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package datatype | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/emicklei/proto" | ||
|
||
"github.com/ignite/cli/v29/ignite/pkg/multiformatname" | ||
"github.com/ignite/cli/v29/ignite/pkg/protoanalysis/protoutil" | ||
) | ||
|
||
// DataBytes is a string data type definition. | ||
var DataBytes = DataType{ | ||
DataType: func(string) string { return "[]byte" }, | ||
CollectionsKeyValueName: func(string) string { return "collections.BytesKey" }, | ||
DefaultTestValue: "[]byte{1, 2, 3, 4, 5}", | ||
ProtoType: func(_, name string, index int) string { | ||
return fmt.Sprintf("bytes %s = %d", name, index) | ||
}, | ||
GenesisArgs: func(name multiformatname.Name, value int) string { | ||
return fmt.Sprintf("%s: []byte(\"%d\"),\n", name.UpperCamel, value) | ||
}, | ||
CLIArgs: func(name multiformatname.Name, _, prefix string, argIndex int) string { | ||
return fmt.Sprintf("%s%s := []byte(args[%d])", prefix, name.UpperCamel, argIndex) | ||
}, | ||
ToBytes: func(name string) string { | ||
return name | ||
}, | ||
ToString: func(name string) string { | ||
return fmt.Sprintf("string(%s)", name) | ||
}, | ||
ToProtoField: func(_, name string, index int) *proto.NormalField { | ||
return protoutil.NewField(name, "bytes", index) | ||
}, | ||
NonIndex: true, | ||
} |
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
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