ejson

package module
v0.0.0-...-228418e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2014 License: Apache-2.0 Imports: 7 Imported by: 0

README

mgo.ejson

A simple package to Marshal/Unmarshal MongoDB's EJson in Go.

ejson

-- import "github.com/OneOfOne/mgo.ejson"

Warning

This is alpha quality at best, and while it works for most ejson types, it is still very expermental.

Usage

func Normalize
func Normalize(m map[string]interface{}) error

Normalize takes in an ejson map and normalizes it to regular bson.

func Unmarshal
func Unmarshal(j []byte, v interface{}) error

Unmarshal takes ejson and a pointer to a struct or a map, converts up the ejson to a clean bson.M then sets v.

warning the current implementation is rather slow.

How it works: ejson -> json.Unmarshal -> cleanup -> bson.Marshal -> bson.Unmarshal

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(m map[string]interface{}) error

Normalize takes in an ejson map and normalizes it to regular bson.

func Unmarshal

func Unmarshal(j []byte, v interface{}) error

Unmarshal takes ejson and a pointer to a struct or a map, converts up the ejson to a clean **bson.M** then sets **v**. ***warning*** the current implementation is rather slow.

How it works: ejson -> json.Unmarshal -> cleanup -> bson.Marshal -> bson.Unmarshal

Types

This section is empty.

Jump to

Keyboard shortcuts

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