Documentation
¶
Overview ¶
Package introspect has shared utilities for reflecting.
Introspection is one level up from reflection.
Index ¶
- func FindProperties(typ reflect.Type) (map[string]FieldTag, error)
- func GetToken(pkg tokens.Package, typ reflect.Type) (tokens.Type, error)
- func StructToMap(i any) map[string]interface{}
- type Annotator
- func (a *Annotator) AddAlias(module tokens.ModuleName, token tokens.TypeName)
- func (a *Annotator) Deprecate(i any, message string)
- func (a *Annotator) Describe(i any, description string)
- func (a *Annotator) SetDefault(i any, defaultValue any, env ...string)
- func (a *Annotator) SetToken(module tokens.ModuleName, token tokens.TypeName)
- type ExplicitType
- type FieldMatcher
- type FieldTag
- type ToPropertiesOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindProperties ¶ added in v0.4.0
func StructToMap ¶
Types ¶
type Annotator ¶ added in v0.4.0
type Annotator struct {
Descriptions map[string]string
Defaults map[string]any
DefaultEnvs map[string][]string
Token string
Aliases []string
DeprecationMessages map[string]string
// contains filtered or unexported fields
}
Annotator implements the Annotator interface as defined in resource/resource.go.
func NewAnnotator ¶ added in v0.4.0
func (*Annotator) AddAlias ¶ added in v0.20.0
func (a *Annotator) AddAlias(module tokens.ModuleName, token tokens.TypeName)
func (*Annotator) SetDefault ¶ added in v0.4.0
SetDefault annotates a struct field with a default value. The default value must be a primitive type in the pulumi type system.
type ExplicitType ¶ added in v0.7.0
ExplicitType is an explicitly specified type ref token.
type FieldMatcher ¶ added in v0.4.0
type FieldMatcher struct {
// contains filtered or unexported fields
}
func NewFieldMatcher ¶ added in v0.4.0
func NewFieldMatcher(i any) FieldMatcher
func (*FieldMatcher) GetField ¶ added in v0.4.0
func (f *FieldMatcher) GetField(field any) (FieldTag, bool, error)
func (*FieldMatcher) TargetStructFields ¶ added in v0.9.0
func (f *FieldMatcher) TargetStructFields(t any) ([]FieldTag, bool, error)
TargetStructFields returns the set of fields that `t` describes for a given matcher.
If `t` is the struct that the field matcher is based on, return all visible fields on the struct. Otherwise `nil, false, nil` is returned.
type FieldTag ¶
type FieldTag struct {
Name string // The name of the field in the Pulumi type system.
Optional bool // If the field is optional in the Pulumi type system.
Internal bool // If the field should exist in the Pulumi type system.
Secret bool // If the field is secret.
ExplicitRef *ExplicitType // The name and version of the external type consumed in the field.
// NOTE: ReplaceOnChanges will only be obeyed when the default diff implementation is used.
ReplaceOnChanges bool // If changes in the field should force a replacement.
}
type ToPropertiesOptions ¶
type ToPropertiesOptions struct {
ComputedKeys []string
}
Click to show internal directories.
Click to hide internal directories.