Documentation ¶
Index ¶
- func GenerateProgramBootstrap(importsContext []*ast.ImportSpec, confNode *ast.GenDecl, varName string) (string, error)
- func GenerateProgramBootstrapFromAstFile(parsedFile *ast.File, varName string) (string, error)
- func GenerateProgramBootstrapFromFile(file string, varName string) (string, error)
- func GenerateProgramBootstrapFromString(content string, varName string) (string, error)
- func LookupPackageName(someDir string) (string, error)
- func LookupPackageNameFromStr(gocode string) string
- type CompiledTemplatesProgram
- type TemplateFileToCompile
- type TemplateToCompile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateProgramBootstrap ¶
func GenerateProgramBootstrap( importsContext []*ast.ImportSpec, confNode *ast.GenDecl, varName string, ) (string, error)
GenerateProgramBootstrap generates the bootstrap program that handles the compilation of the templates from the source file imports and the configuration variable declaration ast.
func GenerateProgramBootstrapFromAstFile ¶
GenerateProgramBootstrapFromAstFile generates the bootstrap program that handles the compilation of the templates from a parsed go source.
func GenerateProgramBootstrapFromFile ¶
GenerateProgramBootstrapFromFile generates the bootstrap program that handles the compilation of the templates from a file path.
func GenerateProgramBootstrapFromString ¶
GenerateProgramBootstrapFromString generates the bootstrap program that handles the compilation of the templates from a go code string.
func LookupPackageName ¶
LookupPackageName search a directory for its declaring package.
func LookupPackageNameFromStr ¶
LookupPackageNameFromStr extract the declaring package from given go source string.
Types ¶
type CompiledTemplatesProgram ¶
type CompiledTemplatesProgram struct {
// contains filtered or unexported fields
}
CompiledTemplatesProgram ...
func NewCompiledTemplatesProgram ¶
func NewCompiledTemplatesProgram(varName string) *CompiledTemplatesProgram
NewCompiledTemplatesProgram prepare a new instance. it automatically adds io and template/parse packages, and declares static idents.
func (*CompiledTemplatesProgram) Compile ¶
func (c *CompiledTemplatesProgram) Compile(config *compiled.Configuration) (string, error)
Compile the configuration, it returns a string of the output program.
func (*CompiledTemplatesProgram) CompileAndWrite ¶
func (c *CompiledTemplatesProgram) CompileAndWrite(config *compiled.Configuration) error
CompileAndWrite the configuration and write the resulting program to config.OutPath.
type TemplateFileToCompile ¶
type TemplateFileToCompile struct {
// contains filtered or unexported fields
}
TemplateFileToCompile links a template file with all the templates defined in it.
type TemplateToCompile ¶
type TemplateToCompile struct { *compiled.TemplateConfiguration // contains filtered or unexported fields }
TemplateToCompile links a configuration and all the template files it matches.