Skip to content

segmentio/go-interpolate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

interpolate

Note
Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.

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.

About

Hello {name.first} (⌐■_■)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages