Documentation ¶
Overview ¶
Package bavard contains helper functions to generate consistent code from text/template templates. it is used by github.com/consensys/gnark && github.com/consensys/gnark-crypto
Index ¶
- func Apache2(copyrightHolder string, year int) func(*Bavard) error
- func Apache2Header(copyrightHolder string, year int) string
- func AssertSlice(input interface{}) (reflect.Value, error)
- func BuildTag(buildTag string) func(*Bavard) error
- func Format(v bool) func(*Bavard) error
- func Funcs(funcs template.FuncMap) func(*Bavard) error
- func GenerateFromFiles(output string, templateF []string, data interface{}, ...) error
- func GenerateFromString(output string, templates []string, data interface{}, ...) error
- func GeneratedBy(label string) func(*Bavard) error
- func Import(v bool) func(*Bavard) error
- func Package(name string) func(*Bavard) error
- func Verbose(v bool) func(*Bavard) error
- type BatchGenerator
- type Bavard
- type Entry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apache2 ¶
Apache2 returns a bavard option to be used in Generate writing an apache2 licence header in the generated file
func Apache2Header ¶ added in v0.1.6
Apache2Header returns a Apache2 header string
func AssertSlice ¶ added in v0.1.11
func BuildTag ¶ added in v0.1.1
BuildTag returns a bavard option to be used in Generate adding build tags string on top of the generated file
func Format ¶
Format returns a bavard option to be used in Generate. If set to true, will run gofmt on generated file. Or simple tab alignment on .s files
func Funcs ¶ added in v0.1.1
Funcs returns a bavard option to be used in Generate. See text/template FuncMap for more info
func GenerateFromFiles ¶ added in v0.1.8
func GenerateFromFiles(output string, templateF []string, data interface{}, options ...func(*Bavard) error) error
GenerateFromFiles will concatenate templates and create output file from executing the resulting text/template see other package functions to add options (package name, licensing, build tags, ...)
func GenerateFromString ¶ added in v0.1.8
func GenerateFromString(output string, templates []string, data interface{}, options ...func(*Bavard) error) error
GenerateFromString will concatenate templates and create output file from executing the resulting text/template see other package functions to add options (package name, licensing, build tags, ...)
func GeneratedBy ¶
GeneratedBy returns a bavard option to be used in Generate writing a standard "Code generated by 'label' DO NOT EDIT"
func Import ¶
Import returns a bavard option to be used in Generate. If set to true, will run goimports
Types ¶
type BatchGenerator ¶ added in v0.1.7
type BatchGenerator struct {
// contains filtered or unexported fields
}
BatchGenerator enables more efficient and clean multiple file generation
func NewBatchGenerator ¶ added in v0.1.7
func NewBatchGenerator(copyrightHolder string, copyrightYear int, generatedBy string) *BatchGenerator
NewBatchGenerator returns a new BatchGenerator