Documentation ¶
Overview ¶
Package parse contains the generic code generation capabilities that power genny.
genny gen "{types}" gen - generates type specific code (to stdout) from generic code (via stdin) {types} - (required) Specific types for each generic type in the source {types} format: {generic}={specific}[,another][ {generic2}={specific2}] Examples: Generic=Specific Generic1=Specific1 Generic2=Specific2 Generic1=Specific1,Specific2 Generic2=Specific3,Specific4
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Builtins = []string{
"bool",
"byte",
"complex128",
"complex64",
"error",
"float32",
"float64",
"int",
"int16",
"int32",
"int64",
"int8",
"rune",
"string",
"uint",
"uint16",
"uint32",
"uint64",
"uint8",
"uintptr",
}
Builtins contains a slice of all built-in Go types.
View Source
var Numbers = []string{
"float32",
"float64",
"int",
"int16",
"int32",
"int64",
"int8",
"uint",
"uint16",
"uint32",
"uint64",
"uint8",
}
Numbers contains a slice of all built-in number types.
Functions ¶
func Generics ¶
func Generics(filename, pkgName string, in io.ReadSeeker, typeSets []map[string]string) ([]byte, error)
Generics parses the source file and generates the bytes replacing the generic types for the keys map with the specific types (its value).
func TypeSet ¶
TypeSet turns a type string into a []map[string]string that can be given to parse.Generics for it to do its magic.
Acceptable args are:
Person=man Person=man Animal=dog Person=man Animal=dog Animal2=cat Person=man,woman Animal=dog,cat Person=man,woman,child Animal=dog,cat Place=london,paris
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.