YeSQL-like abstraction layer for Mongo on Go
Haigo lets you write and use standard MongoDB queries directly from within your Go application.
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.
-
Connect to Mongo (as you would normally)
-
Load Query File: SEE examples/queries.yml for example query files.
hf, err := haigo.LoadQueryFile("queries.yml")
-
Configure Haigo Params:
params := haigo.Params{"name": "Ali", "age": 32}
-
Execute Query/Pipe:
q, err := hf.Queries["FindUser"].Pipe(col, params)
-
Handle result (as you would normally):
q.Count()
- Parse MongoDB Query YAML
- Detect Queries
- Replace Query Params
- Integrate CI
- More/Better Tests
- Better Error Handling