flatten

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2022 License: MPL-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOrAndMustBeArray = errors.New("the value of $or and $and must be an array")
View Source
var ErrTopLevelElementAnd = errors.New("only one top level element is allowed when using the $and operator")
View Source
var ErrTopLevelElementOr = errors.New("only one top level element is allowed when using the $or operator")

Functions

func Flatten

func Flatten(input map[string]interface{}) (map[string]interface{}, error)

Flatten flattens extended JSON which is used to build and store mongodb queries.

Payloads that look like this

{
	"person": {
		"age": {
			"$gte": 5
		}
	}
}

would become

{
	"person.age": {
	  "$gte": 5
	}
}

func FlattenWithPrefix

func FlattenWithPrefix(prefix string, input map[string]interface{}) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL