Categorygithub.com/segmentio/go-interpolate
modulepackage
0.0.2
Repository: https://github.com/segmentio/go-interpolate.git
Documentation: pkg.go.dev

# README

interpolate

Simple interpolation templates ex: Hello {name.first}.

Usage

type Node

type Node interface {
	Value(v interface{}) (string, error)
}

Node represents a literal or interpolated node.

type Template

type Template struct {
}

Template represents a series of literal and interpolated nodes.

func New

func New(s string) (*Template, error)

New template from the given string.

func (*Template) Eval

func (t *Template) Eval(v interface{}) (string, error)

Eval evalutes the given value against the template, returning an error if there's a path mismatch.

# Functions

New template from the given string.

# Structs

Template represents a series of literal and interpolated nodes.

# Interfaces

Node represents a literal or interpolated node.