Documentation ¶
Index ¶
- Variables
- type Case
- type Constructor
- type GetterFunc
- type Plugin
- func NewCSVPlugin() Plugin
- func NewCamelCasePlugin() Plugin
- func NewCoderPlugin() Plugin
- func NewCommandCasePlugin() Plugin
- func NewConstPlugin() Plugin
- func NewDefinitionPlugin() Plugin
- func NewDescriptionerPlugin() Plugin
- func NewDottedCasePlugin() Plugin
- func NewErrorsPlugin() Plugin
- func NewFlagsPlugin() Plugin
- func NewHTTPCodesPlugin() Plugin
- func NewHeaderPlugin() Plugin
- func NewJSONPlugin() Plugin
- func NewMessagesPlugin() Plugin
- func NewNamesPlugin() Plugin
- func NewNamespacerPlugin() Plugin
- func NewOSExitCodesPlugin() Plugin
- func NewParsePlugin() Plugin
- func NewPascalCasePlugin() Plugin
- func NewSQLPlugin() Plugin
- func NewScreamingCasePlugin() Plugin
- func NewSnakeCasePlugin() Plugin
- func NewSourcerPlugin() Plugin
- func NewStringerPlugin() Plugin
- func NewTextPlugin() Plugin
- func NewTrainCasePlugin() Plugin
- func NewTyperPlugin() Plugin
- func NewValuesPlugin() Plugin
- func NewYAMLPlugin() Plugin
- func NewYARPCCodesPlugin() Plugin
- type PluginList
- type ValueType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilTemplate is thrown when a renderer plugin attempts an operation that cannot be performed // because the renderer's template has not been loaded. ErrNilTemplate = errors.New("renderer plugin has nil template") // ErrEmptyResult is thrown when a renderer plugin attempts to export the Result and finds no // data in it's buffer. ErrEmptyResult = errors.New("renderer plugin returned an empty result") )
var All = []Constructor{ NewConstPlugin, NewHeaderPlugin, NewParsePlugin, NewSnakeCasePlugin, NewStringerPlugin, NewNamesPlugin, NewValuesPlugin, NewTextPlugin, NewCamelCasePlugin, NewCommandCasePlugin, NewPascalCasePlugin, NewScreamingCasePlugin, NewDottedCasePlugin, NewTrainCasePlugin, NewDefinitionPlugin, NewCoderPlugin, NewDescriptionerPlugin, NewTyperPlugin, NewSourcerPlugin, NewNamespacerPlugin, NewMessagesPlugin, NewErrorsPlugin, NewSQLPlugin, NewJSONPlugin, NewFlagsPlugin, NewYAMLPlugin, NewCSVPlugin, NewYARPCCodesPlugin, NewHTTPCodesPlugin, NewOSExitCodesPlugin, }
All returns a pre-populated list of plugins written for renum's code generator.
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case int
Case is used to automate the creation of case specific values during rendering.
const ( // CaseSnake represents snake_case CaseSnake Case = iota // CasePascal represents PascalCase CasePascal // CaseScreaming represents SCREAMING_CASE CaseScreaming // CaseCamel represents camelCase CaseCamel // CaseCommand represents command-case CaseCommand // CaseTrain represents TRAIN-CASE CaseTrain // CaseDotted represents dotted.case CaseDotted // CaseDefault is an alias to the default, snake_case CaseDefault = CaseSnake )
type Constructor ¶
type Constructor func() Plugin
Constructor is a type alias to denote the signature for creating plugins.
type GetterFunc ¶
GetterFunc is a type alias to allow retrieval of element fields on the fly.
type Plugin ¶
type Plugin interface { // Name returns the unique identifier of the plugin. This will be used // as the primary key in the renum generator renderer registry. Name() string // Load is called to provide the Plugin with it's Go template for codegen by the generator. Load(b []byte) error // Enabled is called to let a Plugin deterine if it should be used for this configuration. Enabled(c *config.Config) bool // Validate is used to ensure the configuration meets the requirements for this Plugin. Validate(c *config.Config) error // Render should construct the generated code, typically holding the result in a buffer. Render(c *config.Config) error // Result should return the buffer's data, or an error if an unexpected condition arises. Result() ([]byte, error) // Priority is used to determine the insertion order of the Result into the final generated code. Priority() int }
Plugin defines how a plugin is constructed within Renum, allowing for the codegen to be based on a set of Plugin components. These then get executed in parallel, and have their result combined together.
func NewCSVPlugin ¶
func NewCSVPlugin() Plugin
NewCSVPlugin creates a new renum generator plugin to implement csv.Marshaler and csv.Unmarshaler interfaces.
func NewCamelCasePlugin ¶
func NewCamelCasePlugin() Plugin
NewCamelCasePlugin creates a new renum generator plugin to support camelCase enum strings.
func NewCoderPlugin ¶
func NewCoderPlugin() Plugin
NewCoderPlugin creates a new renum generator plugin to support the renum.Coder interface.
func NewCommandCasePlugin ¶
func NewCommandCasePlugin() Plugin
NewCommandCasePlugin creates a new renum generator plugin to support command-case enum strings.
func NewConstPlugin ¶
func NewConstPlugin() Plugin
NewConstPlugin creates a new renum generator plugin to create the const enum definitions.
func NewDefinitionPlugin ¶
func NewDefinitionPlugin() Plugin
NewDefinitionPlugin creates a new renum generator plugin to render the type alias for the renum.Enum base type.
func NewDescriptionerPlugin ¶
func NewDescriptionerPlugin() Plugin
NewDescriptionerPlugin is used to create a renum generator plugin for implementing the renum.Descriptioner interface on enum types.
func NewDottedCasePlugin ¶
func NewDottedCasePlugin() Plugin
NewDottedCasePlugin creates a new renum generator plugin to support dotted.case enum strings.
func NewErrorsPlugin ¶
func NewErrorsPlugin() Plugin
NewErrorsPlugin creates a new renum generator plugin to implement the renum.Error interface on enum types.
func NewFlagsPlugin ¶
func NewFlagsPlugin() Plugin
NewFlagsPlugin creates a new renum generator plugin to support golang flag.Value interface.
func NewHTTPCodesPlugin ¶
func NewHTTPCodesPlugin() Plugin
NewHTTPCodesPlugin creates a new renum generator plugin to implement the renum.HTTPResponder interface.
func NewHeaderPlugin ¶
func NewHeaderPlugin() Plugin
NewHeaderPlugin creates a new renum generator plugin to generate the package and import declaration on the generated code.
func NewJSONPlugin ¶
func NewJSONPlugin() Plugin
NewJSONPlugin creates a new renum generator plugin to implement json.Marshaler and json.Unmarshaler interfaces.
func NewMessagesPlugin ¶
func NewMessagesPlugin() Plugin
NewMessagesPlugin creates a new renum generator plugin to implement the error interface on enum types.
func NewNamesPlugin ¶
func NewNamesPlugin() Plugin
NewNamesPlugin creates a new renum generator plugin to create a string slice of enum values.
func NewNamespacerPlugin ¶
func NewNamespacerPlugin() Plugin
NewNamespacerPlugin creates a new renum generator plugin to implement the renum.Namespacer interface.
func NewOSExitCodesPlugin ¶
func NewOSExitCodesPlugin() Plugin
NewOSExitCodesPlugin creates a new renum generator plugin to implement the renum.ProcessResponder interface.
func NewParsePlugin ¶
func NewParsePlugin() Plugin
NewParsePlugin creates a new renum generator plugin to implement the required Parse{{Type}} function.
func NewPascalCasePlugin ¶
func NewPascalCasePlugin() Plugin
NewPascalCasePlugin creates a new renum generator plugin to support PascalCase enum strings.
func NewSQLPlugin ¶
func NewSQLPlugin() Plugin
NewSQLPlugin creates a new renum generator plugin to support the sql.Scanner and driver.Valuer interfaces.
func NewScreamingCasePlugin ¶
func NewScreamingCasePlugin() Plugin
NewScreamingCasePlugin creates a new renum generator plugin to support SCREAMING_CASE enum strings.
func NewSnakeCasePlugin ¶
func NewSnakeCasePlugin() Plugin
NewSnakeCasePlugin creates a new renum generator plugin to support snake_case enum strings.
func NewSourcerPlugin ¶
func NewSourcerPlugin() Plugin
NewSourcerPlugin creates a new renum generator plugin to implement the renum.Sourcer interface.
func NewStringerPlugin ¶
func NewStringerPlugin() Plugin
NewStringerPlugin creates a new renum generator plugin to support the fmt.Stringer interface.
func NewTextPlugin ¶
func NewTextPlugin() Plugin
NewTextPlugin creates a new renum generator plugin to support the encoding.TextMarshaler and encoding.TextUnmarshaler interfaces.
func NewTrainCasePlugin ¶
func NewTrainCasePlugin() Plugin
NewTrainCasePlugin creates a new renum generator plugin to support TRAIN-CASE enum strings.
func NewTyperPlugin ¶
func NewTyperPlugin() Plugin
NewTyperPlugin creates a new renum generator plugin to support the renum.Typer interface.
func NewValuesPlugin ¶
func NewValuesPlugin() Plugin
NewValuesPlugin creates a new renum generator plugin to add a slice of possible enum values into the package.
func NewYAMLPlugin ¶
func NewYAMLPlugin() Plugin
NewYAMLPlugin creates a new renum generator plugin to support the yaml.Marshaler and yaml.Unmarshaler interfaces.
func NewYARPCCodesPlugin ¶
func NewYARPCCodesPlugin() Plugin
NewYARPCCodesPlugin creates a new renum generator plugin to support the renum.YARPCResponder interface.
type PluginList ¶
type PluginList []Plugin
PluginList implements a slice for Plugins that can be sorted.
func (PluginList) Less ¶
func (r PluginList) Less(i, j int) bool
Less implements the sort.Sort interface.
func (PluginList) Swap ¶
func (r PluginList) Swap(i, j int)
Swap implements the sort.Sort interface.
type ValueType ¶
type ValueType int
ValueType is an alias to help automate the construction of code generated maps for enum lookups.
const ( // ValueTypeString is the default value type and is used to construct map[%s]string{} types. ValueTypeString ValueType = iota // ValueTypeInt is used to construct map[%s]int{} types. ValueTypeInt // ValueTypeYARPCError is used to construct map[%s]yarpcerrors.Code types. ValueTypeYARPCError )
func (ValueType) FormatValue ¶
FormatValue is used to return the format string appropriate for the type of map being built.
Source Files ¶
- all.go
- base.go
- camel_case.go
- caser.go
- coder.go
- command_case.go
- const.go
- csv.go
- definition.go
- descriptioner.go
- dotted_case.go
- enum.go
- errors.go
- flags.go
- header.go
- helpers.go
- http_codes.go
- json.go
- messages.go
- names.go
- namespacer.go
- os_exit_codes.go
- parse.go
- pascal_case.go
- renderer.go
- screaming_case.go
- snake_case.go
- sourcer.go
- sql.go
- stringer.go
- text.go
- train_case.go
- typer.go
- values.go
- yaml.go
- yarpc_codes.go