alliggator

package module
v0.0.0-...-1f7e909 Latest Latest
Warning

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

Go to latest
Published: May 17, 2018 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Alliggator

Alliggator provides a string/bson.M convertion, to be used with the mongodb native driver for Golang. There is no need to stablish a pattern to you json string requests, use the consolidate mongodb aggregate syntax and Alliggator will convert your string it to mgo.bson.M!

Install: go get https://github.com/jamesmallon/Alliggator.git (better use it with golang Dep package manager)
import "github.com/jamesmallon/Alliggator"
jsonStr:= `[{"$match":
                {"domain": "carrierexpress.com.br"}
            },
            {"$project": {
                "_id": 0,
                "domain": 1,
                "ipPort": 1}
            },
            {"$sort": {"ipPort": 1}},
            {"$skip": 1},
            {"$limit": 10}]`

c := session.DB("test").C("people")
err := c.Pipe(alliggator.Piperize(jsonStr)).One(&result)
if err != nil {
	fmt.Println(err)
}

Author: Thiago Mallon thiagomallon@gmail.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChargePipeline

func ChargePipeline(result []models.Aggregation) []bson.M

BuildPipeline

func New

func New() *alliggator

New

func Piperize

func Piperize(jsonString string) []bson.M

FromString

func TreatDollarSign

func TreatDollarSign(jsonString string) string

TreatDollarSign

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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