Documentation ¶
Index ¶
- func LoadTemplatesMap(config Config, templateLoader templates.TemplateLoader, logger log.Logger) (templates.Store, error)
- type Config
- type FileAssets
- type FileAssetsLoader
- type FileExamplesLoader
- type FileParamsLoader
- type FileSchemaLoader
- type FileTemplateInstanceLoader
- type FileTemplateLoader
- type GoTemplate
- type GoTemplateInstanceLoader
- type MustacheTemplate
- type MustacheTemplateInstanceLoader
- func (loader *MustacheTemplateInstanceLoader) LoadTemplateInstance(templateDir string, partName string, logger log.Logger) (templates.TemplateInstance, error)
- func (loader *MustacheTemplateInstanceLoader) TemplateName(partName string) string
- func (loader *MustacheTemplateInstanceLoader) TemplateType() string
- type StaticTemplate
- type StaticTemplateInstanceLoader
- func (loader *StaticTemplateInstanceLoader) LoadTemplateInstance(templateDir string, partName string, logger log.Logger) (templates.TemplateInstance, error)
- func (loader *StaticTemplateInstanceLoader) TemplateName(partName string) string
- func (loader *StaticTemplateInstanceLoader) TemplateType() string
- type TemplateFileNotFoundError
- type TemplateInstanceLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTemplatesMap ¶
func LoadTemplatesMap( config Config, templateLoader templates.TemplateLoader, logger log.Logger, ) (templates.Store, error)
LoadTemplatesMap load templates from directory.
Types ¶
type FileAssets ¶
type FileAssets struct {
// contains filtered or unexported fields
}
FileAssets type.
func NewFileAssets ¶
func NewFileAssets(fileSystem http.FileSystem) *FileAssets
NewFileAssets constructor.
type FileAssetsLoader ¶
type FileAssetsLoader struct{}
FileAssetsLoader type.
func NewFileAssetsLoader ¶
func NewFileAssetsLoader() *FileAssetsLoader
NewFileAssetsLoader constructor.
func (*FileAssetsLoader) LoadAssets ¶
func (fileAssetsLoader *FileAssetsLoader) LoadAssets( templateDirPath string, logger log.Logger, ) templates.Assets
LoadAssets FileSystem from assets dir.
type FileExamplesLoader ¶
type FileExamplesLoader struct{}
FileExamplesLoader type.
func NewFileExamplesLoader ¶
func NewFileExamplesLoader() *FileExamplesLoader
NewFileExamplesLoader constructor.
func (*FileExamplesLoader) LoadExamples ¶
func (examplesLoader *FileExamplesLoader) LoadExamples( templateDirPath string, logger log.Logger, ) (templates.Examples, error)
LoadExamples by path.
type FileParamsLoader ¶
type FileParamsLoader struct{}
FileParamsLoader load params from file.
func NewFileParamsLoader ¶
func NewFileParamsLoader() *FileParamsLoader
NewFileParamsLoader constructor.
func (*FileParamsLoader) LoadParams ¶
func (fileParamsLoader *FileParamsLoader) LoadParams( templateDirPath string, logger log.Logger, ) (*templates.Params, error)
LoadParams from templateDirPath.
type FileSchemaLoader ¶
type FileSchemaLoader struct{}
FileSchemaLoader load JSON Schema from file system.
func NewFileSchemaLoader ¶
func NewFileSchemaLoader() *FileSchemaLoader
NewFileSchemaLoader construct.
func (*FileSchemaLoader) LoadSchema ¶
func (fileSchemaLoader *FileSchemaLoader) LoadSchema( templateDirPath string, logger log.Logger, ) (templates.Validator, error)
LoadSchema from templateDir.
type FileTemplateInstanceLoader ¶
type FileTemplateInstanceLoader struct {
// contains filtered or unexported fields
}
FileTemplateInstanceLoader load templates from file system.
func DefaultFileTemplateInstanceLoader ¶
func DefaultFileTemplateInstanceLoader() *FileTemplateInstanceLoader
DefaultFileTemplateInstanceLoader create FileTemplateInstanceLoader with default list of template engine loaders.
func NewFileTemplateInstanceLoader ¶
func NewFileTemplateInstanceLoader( templateInstanceLoaders ...TemplateInstanceLoader, ) *FileTemplateInstanceLoader
NewFileTemplateInstanceLoader create new FileTemplateInstanceLoader with defined template engine loader.
func (FileTemplateInstanceLoader) LoadTemplateInstance ¶
func (instanceLoader FileTemplateInstanceLoader) LoadTemplateInstance( templateDirPath string, partName string, logger log.Logger, ) (templates.TemplateInstance, error)
LoadTemplateInstance iterate over template instance factory when it not return error.
type FileTemplateLoader ¶
type FileTemplateLoader struct { templates.TemplateInstanceLoader templates.SchemaLoader templates.ParamsLoader templates.AssetsLoader templates.ExamplesLoader }
FileTemplateLoader load template from directory on file system.
func NewFileTemplateLoader ¶
func NewFileTemplateLoader( templateInstanceLoader templates.TemplateInstanceLoader, schemaLoader templates.SchemaLoader, paramsLoader templates.ParamsLoader, assetsLoader templates.AssetsLoader, examplesLoader templates.ExamplesLoader, ) *FileTemplateLoader
NewFileTemplateLoader constructor.
func (*FileTemplateLoader) LoadTemplate ¶
func (templateLoader *FileTemplateLoader) LoadTemplate( templatesDirPath string, templateName string, logger log.Logger, ) (*templates.Template, error)
LoadTemplate load template dir. nolint:funlen
type GoTemplate ¶
type GoTemplate struct { *templatePkg.Template // contains filtered or unexported fields }
GoTemplate wrap go template and JSON schema.
func NewGoTemplate ¶
func NewGoTemplate(template *templatePkg.Template, logger log.Logger) *GoTemplate
NewGoTemplate constructor.
func (*GoTemplate) Render ¶
func (gt *GoTemplate) Render(data interface{}) (string, error)
Render go template.
type GoTemplateInstanceLoader ¶
type GoTemplateInstanceLoader struct{}
GoTemplateInstanceLoader load go template.
func (*GoTemplateInstanceLoader) LoadTemplateInstance ¶
func (loader *GoTemplateInstanceLoader) LoadTemplateInstance( templateDirPath string, partName string, logger log.Logger, ) (templates.TemplateInstance, error)
LoadTemplateInstance go template partName from templateDirPath.
func (*GoTemplateInstanceLoader) TemplateName ¶
func (loader *GoTemplateInstanceLoader) TemplateName(partName string) string
TemplateName return go template name.
func (*GoTemplateInstanceLoader) TemplateType ¶
func (loader *GoTemplateInstanceLoader) TemplateType() string
TemplateType return go template type.
type MustacheTemplate ¶
type MustacheTemplate struct {
// contains filtered or unexported fields
}
MustacheTemplate engine.
func NewMustacheTemplate ¶
func NewMustacheTemplate( template *mustache.Template, logger log.Logger, ) *MustacheTemplate
NewMustacheTemplate constructor.
func (*MustacheTemplate) Render ¶
func (mt *MustacheTemplate) Render(data interface{}) (string, error)
Render mustache template.
type MustacheTemplateInstanceLoader ¶
type MustacheTemplateInstanceLoader struct{}
MustacheTemplateInstanceLoader load mustache template.
func (*MustacheTemplateInstanceLoader) LoadTemplateInstance ¶
func (loader *MustacheTemplateInstanceLoader) LoadTemplateInstance( templateDir string, partName string, logger log.Logger, ) (templates.TemplateInstance, error)
LoadTemplateInstance mustache partName template from templateDir.
func (*MustacheTemplateInstanceLoader) TemplateName ¶
func (loader *MustacheTemplateInstanceLoader) TemplateName(partName string) string
TemplateName return mustache template name.
func (*MustacheTemplateInstanceLoader) TemplateType ¶
func (loader *MustacheTemplateInstanceLoader) TemplateType() string
TemplateType return mustache template type.
type StaticTemplate ¶
type StaticTemplate struct {
// contains filtered or unexported fields
}
StaticTemplate copy HTML on render.
func NewStaticTemplate ¶
func NewStaticTemplate( payload string, logger log.Logger, ) *StaticTemplate
NewStaticTemplate constructor.
func (*StaticTemplate) Render ¶
func (st *StaticTemplate) Render(_ interface{}) (string, error)
Render static template.
type StaticTemplateInstanceLoader ¶
type StaticTemplateInstanceLoader struct{}
StaticTemplateInstanceLoader load static template.
func (*StaticTemplateInstanceLoader) LoadTemplateInstance ¶
func (loader *StaticTemplateInstanceLoader) LoadTemplateInstance( templateDir string, partName string, logger log.Logger, ) (templates.TemplateInstance, error)
LoadTemplateInstance static partName template from templateDir.
func (*StaticTemplateInstanceLoader) TemplateName ¶
func (loader *StaticTemplateInstanceLoader) TemplateName(partName string) string
TemplateName return static template name.
func (*StaticTemplateInstanceLoader) TemplateType ¶
func (loader *StaticTemplateInstanceLoader) TemplateType() string
TemplateType return static template type.
type TemplateFileNotFoundError ¶
type TemplateFileNotFoundError struct {
// contains filtered or unexported fields
}
TemplateFileNotFoundError returned when template not founded on disk.
func NewTemplateFileNotFoundError ¶
func NewTemplateFileNotFoundError( templateType string, templatePath string, ) *TemplateFileNotFoundError
NewTemplateFileNotFoundError construct new TemplateFileNotFoundError.
func (*TemplateFileNotFoundError) Error ¶
func (err *TemplateFileNotFoundError) Error() string
func (*TemplateFileNotFoundError) Is ¶
func (err *TemplateFileNotFoundError) Is(otherErr error) bool
Is for errors.Is.