meta

package
v0.0.0-...-3014a84 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package meta is used to bootstrap the code generator. That is it contains code which generates Go code that gets compiled together with the user design package. The result of that compilation is a tool which generates the final code or documentation consumed by the end-user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	*codegen.GoGenerator

	// Genfunc contains the name of the generator entry point function.
	// The function signature must be:
	//
	// func Genfunc(api *design.APIDefinition) ([]string, error)
	//
	// where "api" contains the DSL generated metadata and the returned
	// string array lists the generated filenames.
	Genfunc string

	// Imports list the imports that are specific for that generator that
	// should be added to the main Go file.
	Imports []*codegen.ImportSpec

	// Flags is the list of flags to be used when invoking the final
	// generator on the command line.
	Flags map[string]string
}

Generator generates the code of, compiles and runs generators. This extra step is necessary to compile in the end user design package so that generator code can iterate through it.

func NewGenerator

func NewGenerator(genfunc string, imports []*codegen.ImportSpec, flags map[string]string) *Generator

NewGenerator returns a meta generator that can run an actual Generator given its factory method and command line flags.

func (*Generator) Generate

func (m *Generator) Generate() ([]string, error)

Generate compiles and runs the generator and returns the generated filenames.

Jump to

Keyboard shortcuts

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