introspect

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProperties added in v0.4.0

func FindProperties(r any) (map[string]FieldTag, error)

func GetToken

func GetToken(pkg tokens.Package, i any) (tokens.Type, error)

Get the token that represents a struct.

func StructToMap

func StructToMap(i any) map[string]interface{}

Types

type Annotator added in v0.4.0

type Annotator struct {
	Descriptions map[string]string
	Defaults     map[string]any
	DefaultEnvs  map[string][]string
	// contains filtered or unexported fields
}

Implements the Annotator interface as defined in resource/resource.go

func NewAnnotator added in v0.4.0

func NewAnnotator(resource any) Annotator

func (*Annotator) Describe added in v0.4.0

func (a *Annotator) Describe(i any, description string)

func (*Annotator) SetDefault added in v0.4.0

func (a *Annotator) SetDefault(i any, defaultValue any, env ...string)

Annotate a 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

type ExplicitType struct {
	Pkg     string
	Version string
	Module  string
	Name    string
}

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)

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.
}

func ParseTag

func ParseTag(field reflect.StructField) (FieldTag, error)

ParseTag gets tag information out of struct tags. It looks under the `pulumi` and `provider` tag namespaces.

type ToPropertiesOptions

type ToPropertiesOptions struct {
	ComputedKeys []string
}

Jump to

Keyboard shortcuts

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