template

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package template wraps a common set of templates around text/template

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(tmpl string, data interface{}, opts ...Opt) (string, error)

String converts a template to a string

func Writer

func Writer(out io.Writer, tmpl string, data interface{}, opts ...Opt) error

Writer outputs a template to an io.Writer

Types

type Opt added in v0.3.0

Opt allows options to be passed to templating functions

func WithFuncs added in v0.3.0

func WithFuncs(funcs gotemplate.FuncMap) Opt

WithFuncs includes additional template functions

type TimeFuncs

type TimeFuncs struct{}

TimeFuncs wraps all time based templates

func (*TimeFuncs) Now

func (t *TimeFuncs) Now() time.Time

Now returns current time

func (*TimeFuncs) Parse

func (t *TimeFuncs) Parse(layout string, value string) (time.Time, error)

Parse parses the current time according to layout

Jump to

Keyboard shortcuts

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