tolerantreader

package module
v0.0.0-...-38bfb51 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 6 Imported by: 0

README

go-tolerant-reader

Go Implementation of a Tolerant Reader as described by Martin Fowler

This repo is in miserable condition. I just picked it out of a project and hardly did any work on it. It has no design patterns and some switch-case with multi-level nesting. At some point i might want to refactor but for now, the code is just straight-forward.

Idea is that JSON input is first Unmarshalled into map[string]interface{}.

Then the resulting structure is passed to the tolerant reader along with a target struct.

The target struct should have some tags describing where in the given source data structure a certain information is expected. Tolerant-Reader will try to find this information and convert it to the data type in the respective struct field if possible.

A usage example can be seen in the test file.

We use this to parse json encoded messages thrown on a kafka message bus by some php applications.

Documentation

Index

Constants

View Source
const ONLYDATE = "2006-01-02"
View Source
const PREFIX = "jsonpath"

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(data map[string]interface{}, o interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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