Documentation
¶
Index ¶
- type Action
- type ActionRunner
- func AddFactoryAction(factory ast.BuilderFactory) ActionRunner
- func AddOptionAction(newOption veneers.Option) ActionRunner
- func ComposeBuildersAction(config CompositionConfig) ActionRunner
- func DebugAction() ActionRunner
- func DuplicateAction(duplicateName string, excludeOptions []string) ActionRunner
- func GenericAction(selector *Selector) ActionRunner
- func InitializeAction(statements []Initialization) ActionRunner
- func MergeIntoAction(sourceBuilderName string, underPath string, excludeOptions []string, ...) ActionRunner
- func PromoteOptionsToConstructorAction(optionNames []string) ActionRunner
- func PropertiesAction(properties []ast.StructField) ActionRunner
- func RenameAction(newName string) ActionRunner
- func VeneerTrailAsCommentsAction() ActionRunner
- type CompositionConfig
- type Initialization
- type Rule
- func AddFactory(selector *Selector, factory ast.BuilderFactory) *Rule
- func AddOption(selector *Selector, newOption veneers.Option) *Rule
- func ComposeBuilders(selector *Selector, config CompositionConfig) *Rule
- func Debug(selector *Selector) *Rule
- func Duplicate(selector *Selector, duplicateName string, excludeOptions []string) *Rule
- func Generic(selector *Selector) *Rule
- func Initialize(selector *Selector, statements []Initialization) *Rule
- func MergeInto(selector *Selector, sourceBuilderName string, underPath string, ...) *Rule
- func Omit(selector *Selector) *Rule
- func PromoteOptionsToConstructor(selector *Selector, optionNames []string) *Rule
- func Properties(selector *Selector, properties []ast.StructField) *Rule
- func Rename(selector *Selector, newName string) *Rule
- func VeneerTrailAsComments(selector *Selector) *Rule
- type RuleCtx
- type Selector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.1.0
type Action struct {
// contains filtered or unexported fields
}
type ActionRunner ¶ added in v0.1.0
func AddFactoryAction ¶ added in v0.1.0
func AddFactoryAction(factory ast.BuilderFactory) ActionRunner
func AddOptionAction ¶ added in v0.1.0
func AddOptionAction(newOption veneers.Option) ActionRunner
func ComposeBuildersAction ¶ added in v0.1.0
func ComposeBuildersAction(config CompositionConfig) ActionRunner
func DebugAction ¶ added in v0.1.0
func DebugAction() ActionRunner
func DuplicateAction ¶ added in v0.1.0
func DuplicateAction(duplicateName string, excludeOptions []string) ActionRunner
func GenericAction ¶ added in v0.1.13
func GenericAction(selector *Selector) ActionRunner
func InitializeAction ¶ added in v0.1.0
func InitializeAction(statements []Initialization) ActionRunner
func MergeIntoAction ¶ added in v0.1.0
func PromoteOptionsToConstructorAction ¶ added in v0.1.0
func PromoteOptionsToConstructorAction(optionNames []string) ActionRunner
func PropertiesAction ¶ added in v0.1.0
func PropertiesAction(properties []ast.StructField) ActionRunner
func RenameAction ¶ added in v0.1.0
func RenameAction(newName string) ActionRunner
func VeneerTrailAsCommentsAction ¶ added in v0.1.0
func VeneerTrailAsCommentsAction() ActionRunner
type CompositionConfig ¶ added in v0.0.8
type CompositionConfig struct {
// SourceBuilderName refers to the builder to use as a source for the
// composition. Builders for "composable" objects will be composed into
// this source builder following the mapping defined in the CompositionMap
// field.
// Note: The builder name must follow the [package].[builder_name] pattern.
// Example: "dashboard.Panel"
SourceBuilderName string
// PluginDiscriminatorField contains the name of the field used to identify
// the plugin implementing this object.
// Example: "type", "kind", ...
PluginDiscriminatorField string
// Composition map describes how to perform the composition.
// Each entry in this map associates a builder (referenced by its name)
// to a path under witch the assignments should be performed.
//
// Example:
// “`go
// compositionMap := map[string]string{
// "Options": "options",
// "FieldConfig": "fieldConfig.defaults.custom",
// }
// “`
CompositionMap map[string]string
// ExcludeOptions lists option names to exclude in the resulting
// composed builders.
ExcludeOptions []string
// ComposedBuilderName configures the name of the newly composed builders.
// If left empty, the name is taken from SourceBuilderName.
ComposedBuilderName string
// PreserveOriginalBuilders ensures that builders used as part of the
// composition process are preserved.
// It is useful when the same builders need to be composed more than once
// (ex: dashboard and dashboardv2 packages both use Options & FieldConfig
// types from panels for their composition needs)
PreserveOriginalBuilders bool
// RenameOption is used to rename the options from the original schema in order
// to avoid conflicts with composed builders.
RenameOptions map[string]string
}
type Initialization ¶
type Rule ¶ added in v0.1.0
func AddFactory ¶ added in v0.0.25
func AddFactory(selector *Selector, factory ast.BuilderFactory) *Rule
AddFactory adds a builder factory to the selected builders. These factories are meant to be used to simplify the instantiation of builders for common use-cases.
func ComposeBuilders ¶ added in v0.0.8
func ComposeBuilders(selector *Selector, config CompositionConfig) *Rule
func Duplicate ¶
Duplicate duplicates a builder. The name of the duplicated builder has to be specified and some options can be excluded.
func Generic ¶ added in v0.1.13
Generic sets a builder as generic. Useful when a language needs special generation when a builder has to be extensible.
func Initialize ¶
func Initialize(selector *Selector, statements []Initialization) *Rule
func PromoteOptionsToConstructor ¶
PromoteOptionsToConstructor promotes the given options as constructor parameters. Both arguments and assignments described by the options will be exposed in the builder's constructor.
func Properties ¶
func Properties(selector *Selector, properties []ast.StructField) *Rule
func VeneerTrailAsComments ¶
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
func ByName ¶
ByName matches builders for the given name. Note: the comparison on builder name is case-insensitive.
func ByObjectName ¶
ByObjectName matches builders for the given the object (referred to by its package and name). Note: the comparison on object name is case-insensitive.
func ByVariant ¶ added in v0.0.8
func ByVariant(variant ast.SchemaVariant) *Selector
ByVariant matches builders defined within a schema marked as "composable" and implementing the given variant.
func StructGeneratedFromDisjunction ¶
func StructGeneratedFromDisjunction() *Selector
StructGeneratedFromDisjunction matches builders for structs that were generated from a disjunction (see the Disjunction compiler pass).