Documentation ¶
Overview ¶
Package field provides methods to parse a field provided in a command with the format name:type
Index ¶
- type Field
- func (f Field) CLIArgs(prefix string, argIndex int) string
- func (f Field) DataType() string
- func (f Field) DefaultTestValue() string
- func (f Field) GenesisArgs(value int) string
- func (f Field) GoCLIImports() []datatype.GoImport
- func (f Field) ProtoFieldName() string
- func (f Field) ProtoImports() []string
- func (f Field) ProtoType(index int) string
- func (f Field) ToBytes(name string) string
- func (f Field) ToProtoField(index int) *proto.NormalField
- func (f Field) ToString(name string) string
- func (f Field) ValueIndex() string
- func (f Field) ValueInvalidIndex() string
- func (f Field) ValueLoop() string
- type Fields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { Name multiformatname.Name DatatypeName datatype.Name Datatype string }
Field represents a field inside a structure for a component it can be a field contained in a type or inside the response of a query, etc...
func (Field) DefaultTestValue ¶
DefaultTestValue returns the Datatype value default.
func (Field) GenesisArgs ¶
GenesisArgs returns the Datatype genesis args.
func (Field) GoCLIImports ¶
GoCLIImports returns the Datatype imports for CLI package.
func (Field) ProtoFieldName ¶
ProtoFieldName returns the field name used in proto.
func (Field) ProtoImports ¶
ProtoImports returns the Datatype imports for proto files.
func (Field) ToProtoField ¶
func (f Field) ToProtoField(index int) *proto.NormalField
ToProtoField returns the Datatype as a *proto.Field node.
func (Field) ValueIndex ¶
ValueIndex returns the Datatype value for indexes.
func (Field) ValueInvalidIndex ¶
ValueInvalidIndex returns the Datatype value for invalid indexes.
type Fields ¶
type Fields []Field
Fields represents a Field slice.
func ParseFields ¶
func ParseFields( fields []string, isForbiddenField func(string) error, forbiddenFieldNames ...string, ) (Fields, error)
ParseFields parses the provided fields, analyses the types and checks there is no duplicated field.
func (Fields) GoCLIImports ¶
GoCLIImports returns all go CLI imports.
func (Fields) ProtoImports ¶
ProtoImports returns all proto imports.