Skip to content

OneOfOne/mgo.ejson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages