Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // KnownTypeMap is the collection of known Go types. KnownTypeMap = map[string]bool{ "bool": true, "string": true, "byte": true, "rune": true, "int": true, "int8": true, "int16": true, "int32": true, "int64": true, "uint": true, "uint8": true, "uint16": true, "uint32": true, "uint64": true, "float32": true, "float64": true, "Slice": true, "StringSlice": true, } ShortNameTypeMap = map[string]string{ "bool": "b", "string": "s", "byte": "b", "rune": "r", "int": "i", "int8": "i", "int16": "i", "int32": "i", "int64": "i", "uint": "u", "uint8": "u", "uint16": "u", "uint32": "u", "uint64": "u", "float32": "f", "float64": "f", } ConflictedShortNames = map[string]bool{ "context": true, "errors": true, "fmt": true, "regexp": true, "strings": true, "time": true, "iterator": true, "spanner": true, "civil": true, "codes": true, "status": true, } )
Functions ¶
func CopyDefaultTemplates ¶
CopyDefaultTemplates copies default templete files to dir.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func NewGenerator(loader Loader, inflector internal.Inflector, opt GeneratorOption) *Generator
func (*Generator) ExecuteTemplate ¶
func (g *Generator) ExecuteTemplate(tt TemplateType, name string, sub string, obj interface{}) error
ExecuteTemplate loads and parses the supplied template with name and executes it with obj as the context.
type GeneratorOption ¶
type Loader ¶
type Loader interface { // NthParam returns the 0-based Nth param for the Loader. NthParam(i int) string }
Loader is the common interface for database drivers that can generate code from a database schema.
type TBuf ¶
type TBuf struct { TemplateType TemplateType Name string Subname string Buf *bytes.Buffer }
TBuf is to hold the executed templates.
type TemplateType ¶
type TemplateType uint
TemplateType represents a template type.
const ( TypeTemplate TemplateType = iota IndexTemplate // always last YOTemplate )
the order here will be the alter the output order per file.
func (TemplateType) String ¶
func (tt TemplateType) String() string
String returns the name for the associated template type.
Click to show internal directories.
Click to hide internal directories.