descriptors

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMessage

func BuildMessage[T any](opts ...BuilderOptions) []*builder.MessageBuilder

Types

type Builder

type Builder struct {
	BuilderOptions
	// contains filtered or unexported fields
}

func (*Builder) BuildMessage

func (b *Builder) BuildMessage(msgType reflect.Type, newFieldHook func(f *builder.FieldBuilder, rf reflect.StructField)) *builder.MessageBuilder

type BuilderOptions

type BuilderOptions struct {
	// Tags to use to get field names, in order of preference.
	FieldNameFromTags []string
	// Called for each field. The provided options can be modified before
	// the field is added to the message by returning a mutator function.
	EditFlagOptions func(rf reflect.StructField) func(*cli.FlagOptions)
	// Called for each field. The provided comment can be modified before
	// the field is added to the message.
	EditFieldComment func(rf reflect.StructField, in *string)
	// Called for each field. If it returns true, the field will be skipped.
	SkipFieldFunc func(rf reflect.StructField) bool

	CustomFieldTypes map[reflect.Type]func() *builder.FieldType

	AllScalarFieldsOptional bool
}

type FlagRegistrar added in v0.11.1

type FlagRegistrar[FS FlagSet[F], F any] interface {
	RegisterFlags(flags FS)
}

type FlagSet added in v0.11.1

type FlagSet[F any] interface {
	VisitAll(func(F))
}

Jump to

Keyboard shortcuts

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