This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
dawa.go
43 lines (38 loc) · 1.47 KB
/
dawa.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// The dawa package can be used to de-serialize structures received from "Danmarks Adressers Web API (DAWA)" (Addresses of Denmark Web API).
//
// This package allows to de-serialize JSON responses from the web api into typed structs.
// The package also allows importing JSON or CSV downloads from the official web page.
// See the /examples folder for more information.
//
// Package home: https://github.com/klauspost/dawa
//
// Information abou the format and download/API options, see http://dawa.aws.dk/
//
// Description text in Danish:
//
// Danmarks Adressers Web API (DAWA) udstiller data og funktionalitet vedrørende Danmarks adresser, adgangsadresser, vejnavne samt postnumre.
// DAWA anvendes til etablering af adressefunktionalitet i it-systemer. Målgruppen for nærværende website er udviklere, som ønsker at indbygge adressefunktionalitet i deres it-systemer.
package dawa
import (
"io"
)
// modify JSONStrictFieldCheck to return an error on unknown fields on JSON import.
// If true, return an error if a map in the stream has a key which does not map to any field; else read and discard the key and value in the stream and proceed to the next.
var JSONStrictFieldCheck = false
type closer struct {
c []io.Closer
}
// Call this when you are finished using the object
func (c *closer) Close() error {
for _, cl := range c.c {
err := cl.Close()
if err != nil {
return err
}
}
c.c = nil
return nil
}
func (c *closer) AddCloser(a io.Closer) {
c.c = append(c.c, a)
}