generator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Config *config.Config
	// contains filtered or unexported fields
}

Generator is responsible for generating validation files for the given in a go source file.

func NewGenerator

func NewGenerator(cfg *config.Config) (*Generator, error)

NewGenerator is a constructor method for creating a new Generator with default templates loaded.

func (*Generator) GenerateEnums

func (g *Generator) GenerateEnums() ([]byte, error)

GenerateEnums renders the Go code of the enums.

func (*Generator) Initialize

func (g *Generator) Initialize() error

Initialize builds an index of the supplied values, calculating things like names and offsets.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is a type that allows for Renderers to be bundled together and have operations performed in parallel on them.

func NewDefaultRegistry

func NewDefaultRegistry() *Registry

NewDefaultRegistry returns a registry with access to all plugins within the renum library.

func NewEmptyRegistry

func NewEmptyRegistry() *Registry

NewEmptyRegistry creates a registry with an empty Plugin table.

func NewRegistryWithPlugins

func NewRegistryWithPlugins(c ...plugins.Constructor) *Registry

NewRegistryWithPlugins is used to create a pre-populated plugin registry by giving this constructor a list of plugins.Constructor types to create each plugin.

func (*Registry) Add

func (r *Registry) Add(rdr plugins.Plugin)

Add inserts the Plugin into it's table.

func (*Registry) Assemble

func (r *Registry) Assemble(c *config.Config) ([]byte, error)

Assemble is used to create the fully assembled Go source file containing the generated enum and all it's implementations.

func (*Registry) Build

func (r *Registry) Build(c *config.Config) error

Build iterates all Plugin plugins to determine if they should be enabled, removing any that should not be enabled. For any remaining, it performs validation to ensure the Plugin plugin is compatible with the provided configuration, then called the Render() function to construct the code segment for that plugin.

func (*Registry) Clone

func (r *Registry) Clone() *Registry

Clone copies a registry, including it's current plugin table.

func (*Registry) Delete

func (r *Registry) Delete(name string)

Delete removes a Plugin of a given name from the Registry's lookup table.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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