cf

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 9 Imported by: 8

README

Cf

Cf is a golang library that offers an opinionated, idiomatic approach for building composable, extensible software frameworks.

Cf is the result of years of work building next-generation network overlay software (see Ziti). Ziti is composed of layered, orthogonal frameworks that encapsulate aspects of the overlay architecure. Ziti is designed to be extensible, and can be configured to work in numerous ways depending on the needs of a specific deployment. Many of the components may or may not exist in a Ziti configuration, and each of the components likely requires a high degree of configurability. Cf helps to manage this kind of complexity.

Cf is spiritually similar to classic "inversion of control" containers as used in languages like Java, but done in an idiomatic golang style.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(cf interface{}, data map[string]interface{}, opt *Options) error

func BindYaml

func BindYaml(cf interface{}, path string, opt *Options) error

func CleanUpInterfaceArray

func CleanUpInterfaceArray(in []interface{}) []interface{}

func CleanUpMapValue

func CleanUpMapValue(v interface{}) interface{}

func Dump

func Dump(cf interface{}, opt *Options) string

func MapIToMapS

func MapIToMapS(in map[interface{}]interface{}) map[string]interface{}

func PassthroughNameConverter

func PassthroughNameConverter(f reflect.StructField) string

func SnakeCaseNameConverter

func SnakeCaseNameConverter(f reflect.StructField) string

Types

type FlexibleSetter

type FlexibleSetter func(v interface{}, opt *Options) (interface{}, error)

type Instantiator

type Instantiator func() interface{}

type NameConverter

type NameConverter func(f reflect.StructField) string

type Options

type Options struct {
	Instantiators         map[reflect.Type]Instantiator
	Setters               map[reflect.Type]Setter
	FlexibleSetters       map[string]FlexibleSetter
	Wirings               map[reflect.Type][]Wiring
	NameConverter         NameConverter
	VariableResolverChain []VariableResolver
}

func DefaultOptions

func DefaultOptions() *Options

func (*Options) AddFlexibleSetter

func (opt *Options) AddFlexibleSetter(typeName string, fs FlexibleSetter) *Options

func (*Options) AddInstantiator

func (opt *Options) AddInstantiator(t reflect.Type, i Instantiator) *Options

func (*Options) AddSetter

func (opt *Options) AddSetter(t reflect.Type, s Setter) *Options

func (*Options) AddVariableResolver added in v0.0.8

func (opt *Options) AddVariableResolver(vr VariableResolver) *Options

func (*Options) AddWiring

func (opt *Options) AddWiring(t reflect.Type, w Wiring) *Options

func (*Options) SetNameConverter

func (opt *Options) SetNameConverter(nc NameConverter) *Options

type Setter

type Setter func(v interface{}, f reflect.Value, opt *Options) error

type VariableResolver added in v0.0.8

type VariableResolver func(name string) (interface{}, bool)

type Wiring

type Wiring func(cf interface{}) error

Jump to

Keyboard shortcuts

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