Documentation
¶
Overview ¶
Package scheme uses the flagsets.OptionSet handling from package flagsets to handle a command line option based configuration of instances of dynamically registered Type declarations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scheme ¶
type Scheme[T any] interface { AddType(t Type[T]) GetTypes() map[string]Type[T] CreateOptionSetConfigProvider() (flagsets.TypedOptionSetConfigProvider, error) CreateObject(config flagsets.Config) (T, error) }
Scheme describes a set of [Type]s and is able to create appropriate implementation variants for a flagsets.Config object by using json un-/marshalling. It uses the flagsets.ConfigOptionTypeSetHandler feature of Type objects to contruct ta flagsets.TypedOptionSetConfigProvider with an appropriate type options use dto select the variant from the given options.
type Type ¶
type Type[T any] interface { flagsets.ConfigOptionTypeSetHandler CreateObject() T }
func NewType ¶
func NewType[T, B any](name string, adder flagsets.ConfigAdder, types ...flagsets.OptionType) Type[B]
NewType creates a new Type for an implementation T, which must implement interface B. Because of the elaborated type system in Go this cannot be expressed as type constraint.