field

package
v29.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package field provides methods to parse a field provided in a command with the format name:type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultipleCoins added in v29.3.0

func MultipleCoins(fields []string) (bool, error)

MultipleCoins checks if the provided fields contain more than one coin type.

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) CLIArgs

func (f Field) CLIArgs(prefix string, argIndex int) string

CLIArgs returns the Datatype CLI args. TODO(@julienrbrt): Once unused and fully replaced by AutoCLI, remove CLIArgs from DataType.

func (Field) CLIUsage

func (f Field) CLIUsage() string

CLIUsage returns the field name used in CLI usage.

func (Field) CollectionsKeyValueType

func (f Field) CollectionsKeyValueType() string

CollectionsKeyValueType returns the field collections key value type.

func (Field) DataType

func (f Field) DataType() string

DataType returns the field Datatype.

func (Field) DefaultTestValue

func (f Field) DefaultTestValue() string

DefaultTestValue returns the Datatype value default.

func (Field) GenesisArgs

func (f Field) GenesisArgs(value int) string

GenesisArgs returns the Datatype genesis args.

func (Field) GoCLIImports

func (f Field) GoCLIImports() []datatype.GoImport

GoCLIImports returns the Datatype imports for CLI package.

func (Field) IsSlice

func (f Field) IsSlice() bool

IsSlice returns true if the field is a slice.

func (Field) ProtoFieldName

func (f Field) ProtoFieldName() string

ProtoFieldName returns the field name used in proto.

func (Field) ProtoImports

func (f Field) ProtoImports() []string

ProtoImports returns the Datatype imports for proto files.

func (Field) ProtoType

func (f Field) ProtoType(index int) string

ProtoType returns the field proto Datatype.

func (Field) ToBytes

func (f Field) ToBytes(name string) string

ToBytes returns the Datatype byte array cast.

func (Field) ToProtoField

func (f Field) ToProtoField(index int) *proto.NormalField

ToProtoField returns the Datatype as a *proto.Field node.

func (Field) ToString

func (f Field) ToString(name string) string

ToString returns the Datatype byte array cast.

func (Field) Value

func (f Field) Value() string

Value returns the field assign value.

func (Field) ValueIndex

func (f Field) ValueIndex() string

ValueIndex returns the Datatype value for indexes.

func (Field) ValueInvalidIndex

func (f Field) ValueInvalidIndex() string

ValueInvalidIndex returns the Datatype value for invalid indexes.

func (Field) ValueLoop

func (f Field) ValueLoop() string

ValueLoop returns the Datatype value for loop iteration.

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) CLIUsage

func (f Fields) CLIUsage() string

CLIUsage returns all inline fields args for CLI command usage.

func (Fields) Custom

func (f Fields) Custom() []string

Custom returns a list of custom fields.

func (Fields) GoCLIImports

func (f Fields) GoCLIImports() []datatype.GoImport

GoCLIImports returns all go CLI imports.

func (Fields) ProtoFieldNameAutoCLI

func (f Fields) ProtoFieldNameAutoCLI() string

ProtoFieldNameAutoCLI returns all inline fields args for name used in proto. It should be used in AutoCLI to generate the field name.

func (Fields) ProtoImports

func (f Fields) ProtoImports() []string

ProtoImports returns all proto imports.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL