mingo

package module
v0.0.0-...-8200df8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: MIT Imports: 2 Imported by: 0

README

go-mingo

Minimal mingo port for Go projects, based on https://github.com/kofrasa/mingo

Install

$ go get github.com/codepushr/go-mingo

Features

  • Query Operators
    • $eq, $gt, $gte, $lt, $lte, $and

Usage

Import go-mingo, create a query and run Test() on it.

import "github.com/codepushr/go-mingo"

func main() {
    q := mingo.Query{Criteria: mingo.Object{
        "type": "ranking",
        "$and": []mingo.Object{
            mingo.Object{
                "score": mingo.Object{
                    "$gt": 5,
                },
            },
        },
    }} 

    result := q.Test(mingo.Object{
        "type":  "ranking",
        "score": 10,
    })
}

Roadmap

  • Support Dot Notation for both <array>.<index> and <document>.<field> selectors

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object map[string]interface{}

Object model

type Query

type Query struct {
	Criteria Object
	// contains filtered or unexported fields
}

Query model

func (*Query) Test

func (q *Query) Test(obj Object) bool

Test method evaluates the query by processing the expression's operators.

type QueryOperator

type QueryOperator struct{}

QueryOperator model

Jump to

Keyboard shortcuts

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