rbtemplate

package
v0.0.0-...-dbdc49b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logs *zap.Logger, cfg Conf, p Params) (*template.Template, error)

New creates the view templates

Types

type Conf

type Conf struct {
	Dir      string   `env:"RB_VIEW_DIR" envDefault:"."`
	Patterns []string `env:"RB_VIEW_PATTERNS" envSeparator:":" envDefault:"*.html"`
	Name     string   `env:"RB_VIEW_NAME" envDefault:"root"`
}

Conf configures the view

func ParseConf

func ParseConf() (cfg Conf, err error)

ParseConf parses the env

type Files

type Files fs.FS

Files are on a filesystem

func FromDir

func FromDir(logs *zap.Logger, cfg Conf) Files

FromDir provides template files from an actual directory

func FromEmbed

func FromEmbed(efs embed.FS) Files

FromEmbed creates a template files fs from an embedded filesystem

type Params

type Params struct {
	fx.In
	Files Files
	Funcs []template.FuncMap `group:"rb.helper"`
}

Params are parameters for view construction

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL