component_definition

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetComponentName

func GetComponentName(t any) string

func GetComponentNameWithAlias

func GetComponentNameWithAlias(t any) (name, alias string)

Types

type ArgType

type ArgType string
const (
	ArgRequired  ArgType = "required"
	ArgQualifier ArgType = "qualifier"
)

type Base

type Base struct {
	Type  reflect.Type
	Value reflect.Value
	// contains filtered or unexported fields
}

func NewBase

func NewBase(c any) *Base

type Field

type Field struct {
	*Base
	Holder      *Holder
	StructField reflect.StructField
}

func (*Field) ID

func (f *Field) ID() string

type Holder

type Holder struct {
	*Base
	Meta    *Meta
	IsEmbed bool
	Holder  *Holder
}

func NewEmbedHolder

func NewEmbedHolder(base *Base, holder *Holder) *Holder

func NewHolder

func NewHolder(m *Meta) *Holder

func (*Holder) ID

func (s *Holder) ID() string

func (*Holder) Stack

func (s *Holder) Stack() string

func (*Holder) Walk

func (s *Holder) Walk(f func(source *Holder) error) error

type Interceptor

type Interceptor = func(name string, m *Meta) error

type Meta

type Meta struct {
	*Base
	ProxyMeta *Meta

	Raw    interface{}
	Fields []*Field

	Dependent []*Meta
	// contains filtered or unexported fields
}

func CreateProxy

func CreateProxy(origin *Meta, name string, newComponent any, interceptors ...Interceptor) (*Meta, error)

func NewMeta

func NewMeta(c any) *Meta

func (*Meta) GetAllProperties

func (m *Meta) GetAllProperties() []*Property

func (*Meta) GetComponentProperties

func (m *Meta) GetComponentProperties() []*Property

func (*Meta) GetConfigurationProperties

func (m *Meta) GetConfigurationProperties() []*Property

func (*Meta) GetDependents

func (m *Meta) GetDependents() (names []string)

func (*Meta) GetProperties

func (m *Meta) GetProperties(t PropertyType) []*Property

func (*Meta) ID

func (m *Meta) ID() string

func (*Meta) IsAlias

func (m *Meta) IsAlias() bool

func (*Meta) IsSelf

func (m *Meta) IsSelf(o *Meta) bool

func (*Meta) IsSingleton

func (m *Meta) IsSingleton() bool

func (*Meta) Name

func (m *Meta) Name() string

func (*Meta) SetName

func (m *Meta) SetName(name string)

func (*Meta) SetProperties

func (m *Meta) SetProperties(properties ...*Property)

func (*Meta) UseProxy

func (m *Meta) UseProxy(origin any)

type Property

type Property struct {
	*Field
	PropertyType PropertyType
	Tag          string
	TagVal       string
	Injects      []*Meta
	// contains filtered or unexported fields
}

func NewProperty

func NewProperty(field *Field, propType PropertyType, tag, tagVal string) *Property

func (*Property) AppendArg

func (n *Property) AppendArg(t ArgType, val []string)

func (*Property) AppendArgs

func (n *Property) AppendArgs(a TagArg)

func (*Property) Args

func (n *Property) Args() TagArg

func (*Property) ID

func (n *Property) ID() string

func (*Property) Inject

func (n *Property) Inject(metas []*Meta) error

func (*Property) SetArg

func (n *Property) SetArg(t ArgType, val []string)

func (*Property) SetArgs

func (n *Property) SetArgs(a TagArg)

func (*Property) String

func (n *Property) String() string

type PropertyType

type PropertyType string
const (
	PropertyTypeConfiguration PropertyType = "configuration"
	PropertyTypeComponent     PropertyType = "component"
)

type TagArg

type TagArg map[ArgType][]string

func (TagArg) Find

func (m TagArg) Find(argType ArgType) ([]string, bool)

func (TagArg) Has

func (m TagArg) Has(argType ArgType, want string) bool

func (TagArg) Parse

func (m TagArg) Parse(tag string) (string, TagArg)

Jump to

Keyboard shortcuts

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