scheme

package
v0.0.0-...-ac72f74 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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.

func New

func New[T any]() Scheme[T]

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.

Jump to

Keyboard shortcuts

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