Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure. The Go structure can be arbitrarily complex, containing slices, other structs, etc. and the decoder will properly decode nested maps and so on into the proper structures in the native Go struct. See the examples to see what the decoder is capable of. The simplest function to start with is Decode. When decoding to a struct, mapstructure will use the field name by default to perform the mapping. For example, if a struct has a field "Username" then mapstructure will look for a key in the source value of "username" (case insensitive). You can change the behavior of mapstructure by using struct tags. The default struct tag that mapstructure looks for is "mapstructure" but you can customize it using DecoderConfig. To rename the key that mapstructure looks for, use the "mapstructure" tag and set a value directly. For example, to change the "username" example above to "user": Embedded structs are treated as if they're another field with that name. By default, the two structs below are equivalent when decoding with mapstructure: This would require an input that looks like below: If your "person" value is NOT nested, then you can append ",squash" to your tag value and mapstructure will treat it as if the embedded struct were part of the struct directly. Example: Now the following input would be accepted: When decoding from a struct to a map, the squash tag squashes the struct fields into a single map. Using the example structs from above: Will be decoded into a map: DecoderConfig has a field that changes the behavior of mapstructure to always squash embedded structs. If there are any unmapped keys in the source value, mapstructure by default will silently ignore them. You can error by setting ErrorUnused in DecoderConfig. If you're using Metadata you can also maintain a slice of the unused keys. You can also use the ",remain" suffix on your tag to collect all unused values in a map. The field with this tag MUST be a map type and should probably be a "map[string]interface{}" or "map[interface{}]interface{}". See example below: Given the input below, Other would be populated with the other values that weren't used (everything but "name"): When decoding from a struct to any other value, you may use the ",omitempty" suffix on your tag to omit that value if it equates to the zero value. The zero value of all types is specified in the Go specification. For example, the zero type of a numeric type is zero ("0"). If the struct field value is zero and a numeric type, the field is empty, and it won't be encoded into the destination type. Since unexported (private) struct fields cannot be set outside the package where they are defined, the decoder will simply skip them. For this output type definition: Using this map as input: The following struct will be decoded: mapstructure is highly configurable. See the DecoderConfig struct for other features and options that are supported.
We can unmarshal an embedded struct with a custom `Unmarshal` method. We can unmarshal embedded structs with mapstructure field annotations. We can annotate a struct with mapstructure field annotations.
Package roaring is an implementation of Roaring Bitmaps in Go. They provide fast compressed bitmap data structures (also called bitset). They are ideally suited to represent sets of integers over relatively small ranges. See http://roaringbitmap.org for details.
Package imap implements IMAP4rev1 (RFC 3501).
Package mmap allows mapping files into memory. It tries to provide a simple, reasonably portable interface, but doesn't go out of its way to abstract away every little platform detail. This specifically means:
Package hashmap provides a lock-free and thread-safe HashMap.
Package maps provides reusable functions for manipulating nested map[string]interface{} maps are common unmarshal products from various serializers such as json, yaml etc.
Package maps provides a client library for the Google Maps Web Service APIs. Please see https://developers.google.com/maps/documentation/webservices/ for an overview of the Maps Web Service API suite.
Package mapcidr implements methods to allow working with CIDRs.
ZCrypto is a research and data collection cryptography library, designed to be used for measuring and analyzing cryptographic deployments on the Internet. It is largely centered around the WebPKI. ZCrypto contains forks of the Golang X.509 and TLS libraries that speak old TLS versions, deprecated ciphers. ZCrypto provides more lenient and open access to X.509 certificates and TLS handshake state than its standard library counterparts. ZCrypto also contains a custom X.509 chain builder, designed for bulk chain building across large sets of certificates.
Implements the IMAP ID Extension, defined in RFC 2971.
Package nmap provides idiomatic `nmap` bindings for go developers.
Package confmap implements a koanf.Provider that takes nested and flat map[string]interface{} config maps and provides them to koanf.
Package nmap provides idiomatic `nmap` bindings for go developers.
Package orderedmap implements an ordered map, i.e. a map that also keeps track of the order in which keys were inserted. All operations are constant-time. Github repo: https://github.com/wk8/go-ordered-map
Package openweathermap is a library for use to access the http://openweathermap.org API. JSON is the only return format supported at this time. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package sm (~ static maps) renders static map images from OSM tiles with markers, paths, and filled areas.
Package orderedmap implements an ordered map, i.e. a map that also keeps track of the order in which keys were inserted. All operations are constant-time. Github repo: https://github.com/wk8/go-ordered-map
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure. The Go structure can be arbitrarily complex, containing slices, other structs, etc. and the decoder will properly decode nested maps and so on into the proper structures in the native Go struct. See the examples to see what the decoder is capable of.