ggen

command module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 6 Imported by: 0

README

ggen - Code generation for Go

Install

go get github.com/iolivernguyen/ggen

Usage

This library helps write your own code generator script.

Plugin Structure

Plugin must implement the ggen.Plugin interface:

type Plugin interface {

	// Name returns name of the plugin. Each plugin must have a different name.
	Name() string

	// Filter is called to determine which packages will be parsed and which will be skipped. It will be called before
	// Generate. It received a FilterEngine and need to call the following methods:
	//
	//     ParsingPackages: Get a list of all packages available for IncludePackage.
	//                      The plugin can only include packages in this list.
	//     IncludePackage:  Make the package available for Generate.
	Filter(FilterEngine) error

	// Generate is called to actually generate code for the given packages. Only packages passed to
	// FilterEngine.IncludePackage are available for Generate.
	Generate(Engine) error
}

LICENSE

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
plugins
one
two

Jump to

Keyboard shortcuts

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