Skip to content

Simple demo of the Golang template language and FuncMap functionality

Notifications You must be signed in to change notification settings

17twenty/hydrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hydrator

Very simple demo to show how to use the template engine of Golang. It's called hydrator as it could form the basis of a templated/JSON data hydrator.

Purpose

  1. Takes in JSON input (try source.json)
  2. Go through the JSON and apply the transformations dictated in external template (try transform.tmpl)
  3. Print formatted JSON to standard out

Hacked together in about 30 mins so don't judge me - and if you find it useful, open a PR and tidy it up!

Getting Started

go get -u github.com/17twenty/hydrator

hydrator -s <source JSON file> -t <transformation template> [-w <output.json>]

Todo

It would be really cool to use the plugins capability to dynamically add new template functions. I'll leave that to someone else tho.

About

Simple demo of the Golang template language and FuncMap functionality

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages