flatten

package
v0.0.0-...-7940cbf Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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