A document‑oriented database with a MongoDB‑like query language, running on top of a single SQLite file. Any Store brings schema‑less flexibility, rich indexes and ACID transactions to embedded Go applications.
⚠️ Status: pre‑1.0 – APIs may change. We actively dog‑food the library in production and welcome early adopters & contributors.
- SQLite + JSON – proven, battle‑tested storage engine with SQLite 3.45+ JSON functions.
- Mongo‑style queries –
$in
,$inc
, comparison & logical operators out of the box. - Automatic indexes – create, ensure or drop compound & unique indexes at runtime.
- ACID transactions – explicit read / write transactions plus convenience helpers.
- Streaming iterators – low‑memory scans with cursor API.
- CLI – quick inspection, import/export and interactive shell.
- Cross‑platform – pure Go, no CGO, runs anywhere Go runs.
go get github.com/anyproto/any-store
go install github.com/anyproto/any-store/cmd/any-store-cli@latest
package main
import (
"context"
"fmt"
"log"
anystore "github.com/anyproto/any-store"
"github.com/anyproto/any-store/anyenc"
)
func main() {
ctx := context.Background()
db, err := anystore.Open(ctx, "/tmp/demo.db", nil)
if err != nil {
log.Fatal(err)
}
defer db.Close()
users, _ := db.Collection(ctx, "users")
_ = users.Insert(ctx,
anyenc.MustParseJson(`{"id": 1, "name": "John"}`),
anyenc.MustParseJson(`{"id": 2, "name": "Jane"}`),
)
res, _ := users.Find(`{"id": {"$in": [1,2]}}`).Sort("-name").Iter(ctx)
for res.Next() {
doc, _ := res.Doc()
fmt.Println(doc.Value().String())
}
}
The full end‑to‑end example lives in example/
and in the API docs.
- API reference – https://pkg.go.dev/github.com/anyproto/any-store
- CLI manual –
any-store-cli --help
Layer | Responsibility |
---|---|
Query builder | Parses Mongo‑like JSON filters and modifiers |
Index engine | Generates composite SQLite indexes, picks optimal index via cost estimator |
Encoding arena | Efficient AnyEnc value arena to minimise GC churn |
Connection pool | Separate read / write SQLite connections for concurrent workloads |
- Fork & clone
make test
– run unit tests- Create your feature branch
- Open a PR and sign the CLA
Please read our Code of Conduct before contributing.
Any Store is released under the MIT License – see LICENSE for details.