[![Circle CI](](

# Haigo 
YeSQL-like abstraction layer for Mongo on Go

### What is Haigo?
Haigo lets you write and use standard MongoDB queries directly from within your
Go application.

### Why?
While working on a project that leveraged Mongo's aggregation framework
extensively, we found that writing complicated queries in Go was painful and
brittle with deeply nested `bson.M` or `map[string]interface{}` clauses.

With Haigo, you can use the JSON formatted Mongo queries directly.

### Usage

1. Connect to Mongo (as you would normally)

1. Load Query File: _SEE [examples/queries.yml](/examples/queries.yml) for example query files._  
        ```hf, err := haigo.LoadQueryFile("queries.yml")```

1. Configure Haigo Params:  
        ```params := haigo.Params{"name": "Ali", "age": 32}```

1. Execute Query/Pipe:  
        ```q, err := hf.Queries["FindUser"].Pipe(col, params)```

1. Handle result (as you would normally):  

### TODO
- [x] Parse MongoDB Query YAML
- [x] Detect Queries
- [x] Replace Query Params
- [x] Integrate CI
- [ ] More/Better Tests
- [ ] Better Error Handling

Imports 2 package(s)


Test imports 1 package(s)