generator

package
v0.0.0-...-7424302 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Package           string       `json:"package"`
	ImportPath        string       `json:"import_path"`
	SeparatorComments bool         `json:"separator_comments"`
	Items             []ConfigItem `json:"items"`
}

Config is a collection of ConfigItem structs.

func (*Config) LoadJSON

func (c *Config) LoadJSON(b []byte) error

LoadJSON loads the JSON object contained in the []byte b into a *Config.

func (*Config) LoadJSONFile

func (c *Config) LoadJSONFile(path string) error

LoadJSONFile reads from the file pointed to by path and reads the JSON object contained within into a *Config.

type ConfigItem

type ConfigItem struct {
	Name       string   `json:"name"`
	Type       string   `json:"type"`
	Imports    []string `json:"imports"` // TODO Separate imports for source and test?
	Implement  []string `json:"implement"`
	Tests      []string `json:"tests"`
	TestValues []string `json:"testValues"`
}

ConfigItem is a set of configuration values for a Generator.

type Result

type Result struct {
	Source []byte
	Test   []byte
}

A Result contains the source and test code results from a code generator operation.

func Generate

func Generate(cfg Config) (Result, error)

Generate generates the source and test code for a set of optional types.

Jump to

Keyboard shortcuts

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