Functional Programming in Go With dcode

Aaron Schlesinger
Mar 11 · 4 min read
You can take a Gopher’s red stapler, but you can never take their functional programming

dcode

Inspiration

Usage

{  "firstName": "John",  "lastName" : "doe",  "age"      : 26,  "address"  : {    "streetAddress": "naist street",    "city"         : "Nara",    "postalCode"   : "630-0192",    "accessInstructions": {      "gate": true,      "message": "Please dial 0123 so I can buzz you into the gate"    }  }}
decoder := Field(
"address",
Field("accessInstructions"),
Field("message", String()),
)
decoder := First("address").Then("accessInstructions").Then("message").Into(String())

Why?

Composable

func (d *Decoder) Decode(b []byte, i interface{}) error

Loosely Coupled

Get Started!


Aaron Schlesinger

Written by

Gopher, containerizer, and Kubernetes-er

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade