Closed hkelley closed 3 years ago
Slices!
recordData := mmdbtype.Map{
"city": mmdbtype.Map{
"names": mmdbtype.Map{
"en": mmdbtype.String(vlanLoc.City + ": " + vlanLoc.AdNet),
},
},
"subdivisions": mmdbtype.Slice{
mmdbtype.Map{
"iso_code": mmdbtype.String(vlanLoc.Province),
"names": mmdbtype.Map{"en": mmdbtype.String("subdivison 1? data here")},
},
mmdbtype.Map{
"iso_code": mmdbtype.String(vlanLoc.Province),
"names": mmdbtype.Map{"en": mmdbtype.String("subdivison 2? data here")},
},
},
I am very new to both Go and the inner workings of MaxMind DB. My goal is to merge my private IP ranges into an existing City MMDB. I have been able to insert most data elements but I have not figured out how to add subdivisions as a JSON array in Go.
This does not produce an array:
Putting array brackets "[]" in from of the "mmdbtype.Map" triggers this error in the compiler.
Example of the above:
How can this be constructed so that an array like the following is added to the MMDB?