Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ds9

Zero-dependency Google Cloud Datastore client for Go. Drop-in replacement for `cloud.google.com/go/datastore` basic operations.
Zero-dependency Google Cloud Datastore client for Go. Drop-in replacement for `cloud.google.com/go/datastore` basic operations. In-memory mock implementation. Comprehensive testing.

**Why?** The official client has 50+ dependencies. `ds9` uses only Go stdlib—ideal for lightweight services and minimizing supply chain risk.

Expand All @@ -12,16 +12,24 @@ go get github.com/codeGROOVE-dev/ds9

## Quick Start

This isn't the API we would choose, but our primary goal was a drop-in replacement, so usage is exactly the same as the cloud.google.com/go/datastore library:

```go
import "github.com/codeGROOVE-dev/ds9"
import "github.com/codeGROOVE-dev/ds9/pkg/datastore"

client, _ := ds9.NewClient(ctx, "my-project")
key := ds9.NameKey("Task", "task-1", nil)
client, _ := datastore.NewClient(ctx, "my-project")
key := datastore.NameKey("Task", "task-1", nil)
client.Put(ctx, key, &task)
client.Get(ctx, key, &task)
```

**Supported:**
## Migrating from cloud.google.com/go/datastore

Just switch the import path from `cloud.google.com/go/datastore` to `github.com/codeGROOVE-dev/ds9/pkg/datastore`.

## Features

**Supported Features**
- **CRUD**: Get, Put, Delete, GetMulti, PutMulti, DeleteMulti
- **Transactions**: RunInTransaction, NewTransaction, Commit, Rollback
- **Queries**: Filter, Order, Limit, Offset, Ancestor, Project, Distinct, DistinctOn, Namespace, Run (iterator), Count
Expand All @@ -30,18 +38,14 @@ client.Get(ctx, key, &task)
- **Mutations**: NewInsert, NewUpdate, NewUpsert, NewDelete, Mutate
- **Types**: string, int, int64, int32, bool, float64, time.Time, slices ([]string, []int64, []int, []float64, []bool)

## Migrating from Official Client

Change the import—API is compatible:
```go
// import "cloud.google.com/go/datastore"
import "github.com/codeGROOVE-dev/ds9"
```
**Unsupported Features**

Use `ds9mock` package for in-memory testing. See [TESTING.md](TESTING.md) for integration tests.
These features are unsupported just because we haven't found a use for the feature yet. PRs welcome:

## Limitations
* Embedded structs, nested slices, map types, some advanced query features (streaming aggregations, OR filters).

Not supported: embedded structs, nested slices, map types, some advanced query features (streaming aggregations, OR filters).
## Testing

See [example/](example/) for usage. Apache 2.0 licensed.
* Use `github.com/codeGROOVE-dev/ds9/pkg/mock` package for in-memory testing. It should work even if you choose not to use ds9.
* See [TESTING.md](TESTING.md) for integration tests.
* We aim to maintain 85% test coverage - please don't send PRs without tests.
Loading
Loading