Commit Briefs

cb667a50cb Oliver Lowe

Store last Host check result and time

Includes tests and simplified unmarshal test.


c26e0f9dab Oliver Lowe

Use default MarshalJSON method

There's no point doing so much manual work and testing just to keep fields under a "attrs" key when marshalling to JSON. When creating the object we can just: 1. Marshal the object to JSON 2. Put it all under a "attrs" key. Now it's easier to imagine the mapping of the structs to JSON, since they follow the same rules as everything else in Go.


717a9e7823 Oliver Lowe

Keep test data in version control

While here also don't log messages in testing unless there's an error.


46ca0f68f5 Oliver Lowe

Marshal using struct tags rather than a custom map

I was excluding some struct fields so I thought I'd need to do some custom marshalling . But you don't need to do this as you can use struct tags to optionally exclude things from being put into JSON. Now there's no longer duplicate code between struct tags and keys in a map when marshalling. Handy!


562d5c1eb8 Oliver Lowe

Store acknowledgement status of hosts, services


dd0af5f789 Oliver Lowe

Correctly marshal Hosts into JSON

We were missing some attributes, like not adding any groups or display names. This also adds a test which checks whether we are marshalling hosts into JSON correctly.