yaml

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddAssignment

type AddAssignment struct {
	OptionSelector `yaml:",inline"`
	Assignment     veneers.Assignment `yaml:"assignment"`
}

func (AddAssignment) AsRewriteRule

func (rule AddAssignment) AsRewriteRule(pkg string) (option.RewriteRule, error)

type AddFields

type AddFields struct {
	// Expected format: [package].[object]
	To     string
	Fields []ast.StructField
}

func (AddFields) AsCompilerPass

func (pass AddFields) AsCompilerPass() (*compiler.AddFields, error)

type AddObject added in v0.0.5

type AddObject struct {
	Object string // Expected format: [package].[object]
	As     ast.Type
}

func (AddObject) AsCompilerPass added in v0.0.5

func (pass AddObject) AsCompilerPass() (*compiler.AddObject, error)

type AddOption

type AddOption struct {
	BuilderSelector `yaml:",inline"`
	Option          veneers.Option `yaml:"option"`
}

func (AddOption) AsRewriteRule

func (rule AddOption) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type AnonymousStructsToNamed

type AnonymousStructsToNamed struct {
}

func (AnonymousStructsToNamed) AsCompilerPass

type ArrayToAppend

type ArrayToAppend struct {
	OptionSelector `yaml:",inline"`
}

func (ArrayToAppend) AsRewriteRule

func (rule ArrayToAppend) AsRewriteRule(pkg string) (option.RewriteRule, error)

type BuilderRule

type BuilderRule struct {
	Omit                     *BuilderSelector          `yaml:"omit"`
	Rename                   *RenameBuilder            `yaml:"rename"`
	MergeInto                *MergeInto                `yaml:"merge_into"`
	ComposeDashboardPanel    *ComposeDashboardPanel    `yaml:"compose_dashboard_panel"`
	Properties               *Properties               `yaml:"properties"`
	Duplicate                *Duplicate                `yaml:"duplicate"`
	Initialize               *Initialize               `yaml:"initialize"`
	PromoteOptsToConstructor *PromoteOptsToConstructor `yaml:"promote_options_to_constructor"`
	AddOption                *AddOption                `yaml:"add_option"`
	DefaultToConstant        *DefaultToConstant        `yaml:"default_to_constant"`
}

func (BuilderRule) AsRewriteRule

func (rule BuilderRule) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type BuilderSelector

type BuilderSelector struct {
	ByObject *string `yaml:"by_object"`
	ByName   *string `yaml:"by_name"`

	GeneratedFromDisjunction *bool `yaml:"generated_from_disjunction"` // noop?
}

func (BuilderSelector) AsSelector

func (selector BuilderSelector) AsSelector(pkg string) (builder.Selector, error)

type ByNamesSelector

type ByNamesSelector struct {
	Object  string   `yaml:"object"`
	Options []string `yaml:"options"`
}

func (ByNamesSelector) AsSelector

func (selector ByNamesSelector) AsSelector(pkg string) (option.Selector, error)

type Compiler

type Compiler struct {
	Passes []CompilerPass `yaml:"passes"`
}

type CompilerLoader

type CompilerLoader struct {
}

func NewCompilerLoader

func NewCompilerLoader() *CompilerLoader

func (*CompilerLoader) Load

func (loader *CompilerLoader) Load(reader io.Reader) (compiler.Passes, error)

func (*CompilerLoader) LoadAll

func (loader *CompilerLoader) LoadAll(readers []io.Reader) (compiler.Passes, error)

func (*CompilerLoader) PassesFrom

func (loader *CompilerLoader) PassesFrom(filenames []string) (compiler.Passes, error)

type CompilerPass

type CompilerPass struct {
	EntrypointIdentification *EntrypointIdentification `yaml:"entrypoint_identification"`
	DataqueryIdentification  *DataqueryIdentification  `yaml:"dataquery_identification"`
	Unspec                   *Unspec                   `yaml:"unspec"`
	SetDatasourceToDataquery *SetDatasourceToDataquery `yaml:"set_datasource_to_dataquery"`
	FieldsSetDefault         *FieldsSetDefault         `yaml:"fields_set_default"`
	FieldsSetRequired        *FieldsSetRequired        `yaml:"fields_set_required"`
	FieldsSetNotRequired     *FieldsSetNotRequired     `yaml:"fields_set_not_required"`
	Omit                     *Omit                     `yaml:"omit"`
	AddFields                *AddFields                `yaml:"add_fields"`
	NameAnonymousStruct      *NameAnonymousStruct      `yaml:"name_anonymous_struct"`
	AddObject                *AddObject                `yaml:"add_object"`
	RenameObject             *RenameObject             `yaml:"rename_object"`
	RetypeObject             *RetypeObject             `yaml:"retype_object"`
	HintObject               *HintObject               `yaml:"hint_object"`
	RetypeField              *RetypeField              `yaml:"retype_field"`
	SchemaSetIdentifier      *SchemaSetIdentifier      `yaml:"schema_set_identifier"`
	SchemaSetEntryPoint      *SchemaSetEntryPoint      `yaml:"schema_set_entry_point"`
	DuplicateObject          *DuplicateObject          `yaml:"duplicate_object"`

	AnonymousStructsToNamed *AnonymousStructsToNamed `yaml:"anonymous_structs_to_named"`

	DisjunctionToType                       *DisjunctionToType                       `yaml:"disjunction_to_type"`
	DisjunctionOfAnonymousStructsToExplicit *DisjunctionOfAnonymousStructsToExplicit `yaml:"disjunction_of_anonymous_structs_to_explicit"`
	DisjunctionInferMapping                 *DisjunctionInferMapping                 `yaml:"disjunction_infer_mapping"`
	DisjunctionWithConstantToDefault        *DisjunctionWithConstantToDefault        `yaml:"disjunction_with_constant_to_default"`
}

func (CompilerPass) AsCompilerPass

func (pass CompilerPass) AsCompilerPass() (compiler.Pass, error)

type ComposeDashboardPanel

type ComposeDashboardPanel struct {
	PanelBuilderName         string            `yaml:"panel_builder_name"`
	PluginDiscriminatorField string            `yaml:"plugin_discriminator_field"`
	ExcludePanelOptions      []string          `yaml:"exclude_panel_options"`
	CompositionMap           map[string]string `yaml:"composition_map"`
	ComposedBuilderName      string            `yaml:"composed_builder_name"`
}

func (ComposeDashboardPanel) AsRewriteRule

func (rule ComposeDashboardPanel) AsRewriteRule() (builder.RewriteRule, error)

type DataqueryIdentification

type DataqueryIdentification struct {
}

func (DataqueryIdentification) AsCompilerPass

type DefaultToConstant

type DefaultToConstant struct {
	BuilderSelector `yaml:",inline"`
	Options         []string `yaml:"options"`
}

func (DefaultToConstant) AsRewriteRule

func (rule DefaultToConstant) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type DisjunctionAsOptions

type DisjunctionAsOptions struct {
	OptionSelector `yaml:",inline"`
}

func (DisjunctionAsOptions) AsRewriteRule

func (rule DisjunctionAsOptions) AsRewriteRule(pkg string) (option.RewriteRule, error)

type DisjunctionInferMapping

type DisjunctionInferMapping struct {
}

func (DisjunctionInferMapping) AsCompilerPass

type DisjunctionOfAnonymousStructsToExplicit

type DisjunctionOfAnonymousStructsToExplicit struct {
}

func (DisjunctionOfAnonymousStructsToExplicit) AsCompilerPass

type DisjunctionToType

type DisjunctionToType struct {
}

func (DisjunctionToType) AsCompilerPass

func (pass DisjunctionToType) AsCompilerPass() (*compiler.DisjunctionToType, error)

type DisjunctionWithConstantToDefault

type DisjunctionWithConstantToDefault struct {
}

func (DisjunctionWithConstantToDefault) AsCompilerPass

type Duplicate

type Duplicate struct {
	BuilderSelector `yaml:",inline"`
	As              string   `yaml:"as"`
	ExcludeOptions  []string `yaml:"exclude_options"`
}

func (Duplicate) AsRewriteRule

func (rule Duplicate) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type DuplicateObject added in v0.0.3

type DuplicateObject struct {
	Object     string // Expected format: [package].[object]
	As         string
	OmitFields []string `yaml:"omit_fields"`
}

func (DuplicateObject) AsCompilerPass added in v0.0.3

func (pass DuplicateObject) AsCompilerPass() (*compiler.DuplicateObject, error)

type DuplicateOption

type DuplicateOption struct {
	OptionSelector `yaml:",inline"`
	As             string `yaml:"as"`
}

func (DuplicateOption) AsRewriteRule

func (rule DuplicateOption) AsRewriteRule(pkg string) (option.RewriteRule, error)

type EntrypointIdentification

type EntrypointIdentification struct {
}

func (EntrypointIdentification) AsCompilerPass

func (pass EntrypointIdentification) AsCompilerPass() *compiler.InferEntrypoint

type FieldsSetDefault

type FieldsSetDefault struct {
	Defaults map[string]any // Expected format: [package].[object].[field] → value
}

func (FieldsSetDefault) AsCompilerPass

func (pass FieldsSetDefault) AsCompilerPass() (*compiler.FieldsSetDefault, error)

type FieldsSetNotRequired

type FieldsSetNotRequired struct {
	Fields []string // Expected format: [package].[object].[field]
}

func (FieldsSetNotRequired) AsCompilerPass

func (pass FieldsSetNotRequired) AsCompilerPass() (*compiler.FieldsSetNotRequired, error)

type FieldsSetRequired

type FieldsSetRequired struct {
	Fields []string // Expected format: [package].[object].[field]
}

func (FieldsSetRequired) AsCompilerPass

func (pass FieldsSetRequired) AsCompilerPass() (*compiler.FieldsSetRequired, error)

type HintObject

type HintObject struct {
	Object string // Expected format: [package].[object]
	Hints  ast.JenniesHints
}

func (HintObject) AsCompilerPass

func (pass HintObject) AsCompilerPass() (*compiler.HintObject, error)

type Initialization

type Initialization struct {
	Property string `yaml:"property"`
	Value    any    `yaml:"value"`
}

type Initialize

type Initialize struct {
	BuilderSelector `yaml:",inline"`
	Set             []Initialization `yaml:"set"`
}

func (Initialize) AsRewriteRule

func (rule Initialize) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type MergeInto

type MergeInto struct {
	Destination    string            `yaml:"destination"`
	Source         string            `yaml:"source"`
	UnderPath      string            `yaml:"under_path"`
	ExcludeOptions []string          `yaml:"exclude_options"`
	RenameOptions  map[string]string `yaml:"rename_options"`
}

func (MergeInto) AsRewriteRule

func (rule MergeInto) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type NameAnonymousStruct

type NameAnonymousStruct struct {
	Field string // Expected format: [package].[object].[field]
	As    string
}

func (NameAnonymousStruct) AsCompilerPass

func (pass NameAnonymousStruct) AsCompilerPass() (*compiler.NameAnonymousStruct, error)

type Omit

type Omit struct {
	Objects []string // Expected format: [package].[object]
}

func (Omit) AsCompilerPass

func (pass Omit) AsCompilerPass() (*compiler.Omit, error)

type OptionRule

type OptionRule struct {
	Omit                    *OptionSelector          `yaml:"omit"`
	Rename                  *RenameOption            `yaml:"rename"`
	RenameArguments         *RenameArguments         `yaml:"rename_arguments"`
	UnfoldBoolean           *UnfoldBoolean           `yaml:"unfold_boolean"`
	StructFieldsAsArguments *StructFieldsAsArguments `yaml:"struct_fields_as_arguments"`
	StructFieldsAsOptions   *StructFieldsAsOptions   `yaml:"struct_fields_as_options"`
	ArrayToAppend           *ArrayToAppend           `yaml:"array_to_append"`
	DisjunctionAsOptions    *DisjunctionAsOptions    `yaml:"disjunction_as_options"`
	Duplicate               *DuplicateOption         `yaml:"duplicate"`
	AddAssignment           *AddAssignment           `yaml:"add_assignment"`
}

func (OptionRule) AsRewriteRule

func (rule OptionRule) AsRewriteRule(pkg string) (option.RewriteRule, error)

type OptionSelector

type OptionSelector struct {
	// objectName.optionName
	ByName *string `yaml:"by_name"`

	// builderName.optionName
	// TODO: ByName should be called ByObject
	// and ByBuilder should be called ByName
	ByBuilder *string `yaml:"by_builder"`

	ByNames *ByNamesSelector `yaml:"by_names"`
}

func (OptionSelector) AsSelector

func (selector OptionSelector) AsSelector(pkg string) (option.Selector, error)

type PromoteOptsToConstructor

type PromoteOptsToConstructor struct {
	BuilderSelector `yaml:",inline"`
	Options         []string `yaml:"options"`
}

func (PromoteOptsToConstructor) AsRewriteRule

func (rule PromoteOptsToConstructor) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type Properties

type Properties struct {
	BuilderSelector `yaml:",inline"`
	Set             []ast.StructField `yaml:"set"`
}

func (Properties) AsRewriteRule

func (rule Properties) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type RenameArguments

type RenameArguments struct {
	OptionSelector `yaml:",inline"`

	As []string `yaml:"as"`
}

func (RenameArguments) AsRewriteRule

func (rule RenameArguments) AsRewriteRule(pkg string) (option.RewriteRule, error)

type RenameBuilder

type RenameBuilder struct {
	BuilderSelector `yaml:",inline"`

	As string `yaml:"as"`
}

func (RenameBuilder) AsRewriteRule

func (rule RenameBuilder) AsRewriteRule(pkg string) (builder.RewriteRule, error)

type RenameObject

type RenameObject struct {
	From string // Expected format: [package].[object]
	To   string
}

func (RenameObject) AsCompilerPass

func (pass RenameObject) AsCompilerPass() (*compiler.RenameObject, error)

type RenameOption

type RenameOption struct {
	OptionSelector `yaml:",inline"`

	As string `yaml:"as"`
}

func (RenameOption) AsRewriteRule

func (rule RenameOption) AsRewriteRule(pkg string) (option.RewriteRule, error)

type RetypeField

type RetypeField struct {
	Field    string // Expected format: [package].[object].[field]
	As       ast.Type
	Comments []string
}

func (RetypeField) AsCompilerPass

func (pass RetypeField) AsCompilerPass() (*compiler.RetypeField, error)

type RetypeObject

type RetypeObject struct {
	Object   string // Expected format: [package].[object]
	As       ast.Type
	Comments []string
}

func (RetypeObject) AsCompilerPass

func (pass RetypeObject) AsCompilerPass() (*compiler.RetypeObject, error)

type SchemaSetEntryPoint added in v0.0.5

type SchemaSetEntryPoint struct {
	Package    string
	EntryPoint string `yaml:"entry_point"`
}

func (SchemaSetEntryPoint) AsCompilerPass added in v0.0.5

func (pass SchemaSetEntryPoint) AsCompilerPass() (*compiler.SchemaSetEntrypoint, error)

type SchemaSetIdentifier

type SchemaSetIdentifier struct {
	Package    string
	Identifier string
}

func (SchemaSetIdentifier) AsCompilerPass

func (pass SchemaSetIdentifier) AsCompilerPass() (*compiler.SchemaSetIdentifier, error)

type SetDatasourceToDataquery

type SetDatasourceToDataquery struct{}

func (SetDatasourceToDataquery) AsCompilerPass

type StructFieldsAsArguments

type StructFieldsAsArguments struct {
	OptionSelector `yaml:",inline"`
	Fields         []string `yaml:"fields"`
}

func (StructFieldsAsArguments) AsRewriteRule

func (rule StructFieldsAsArguments) AsRewriteRule(pkg string) (option.RewriteRule, error)

type StructFieldsAsOptions

type StructFieldsAsOptions struct {
	OptionSelector `yaml:",inline"`
	Fields         []string `yaml:"fields"`
}

func (StructFieldsAsOptions) AsRewriteRule

func (rule StructFieldsAsOptions) AsRewriteRule(pkg string) (option.RewriteRule, error)

type UnfoldBoolean

type UnfoldBoolean struct {
	OptionSelector `yaml:",inline"`

	TrueAs  string `yaml:"true_as"`
	FalseAs string `yaml:"false_as"`
}

func (UnfoldBoolean) AsRewriteRule

func (rule UnfoldBoolean) AsRewriteRule(pkg string) (option.RewriteRule, error)

type Unspec

type Unspec struct {
}

func (Unspec) AsCompilerPass

func (pass Unspec) AsCompilerPass() *compiler.Unspec

type Veneers

type Veneers struct {
	Language string        `yaml:"language"`
	Package  string        `yaml:"package"`
	Builders []BuilderRule `yaml:"builders"`
	Options  []OptionRule  `yaml:"options"`
}

type VeneersLoader

type VeneersLoader struct {
}

func NewVeneersLoader

func NewVeneersLoader() *VeneersLoader

func (*VeneersLoader) Load

func (loader *VeneersLoader) Load(reader io.Reader) (rewrite.LanguageRules, error)

func (*VeneersLoader) LoadAll

func (loader *VeneersLoader) LoadAll(readers []io.Reader) ([]rewrite.LanguageRules, error)

func (*VeneersLoader) RewriterFrom

func (loader *VeneersLoader) RewriterFrom(filenames []string, config rewrite.Config) (*rewrite.Rewriter, error)

Jump to

Keyboard shortcuts

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