field

package
v28.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 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

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

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

CLIArgs returns the Datatype CLI args.

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

func (f Fields) Custom() []string

Custom return a list of custom fields.

func (Fields) GoCLIImports

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

GoCLIImports returns all go CLI imports.

func (Fields) ProtoImports

func (f Fields) ProtoImports() []string

ProtoImports returns all proto imports.

func (Fields) String

func (f Fields) String() string

String returns all inline fields args for command usage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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