Documentation ¶
Overview ¶
Package bsonutil provides a number of simple common utilities for interacting bson-tagged structs in go.
This code originates in the Evergreen project and is a centerpiece of that project's document mapping strategy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDottedKeyName ¶
GetDottedKeyName assembles a key name, for use in queries, of a nested field name.
func MustHaveTag ¶
MustHaveTag gets the "bson" struct tag for a field, panicking if either the field does not exist or has no "bson" tag.
func Tag ¶
Tag returns the value of the "bson" tag for the given struct field name of the "data" struct, stripping any tag modifiers such as "omitempty". Returns the empty string if there is no tag, and an error if the field does not exist in the struct.
If data is a slice of structs, this check applies to the type of struct in the slice.
Types ¶
This section is empty.