(AE|Cloud) Datastore Wrapper
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci feat(core): update dependencies Oct 22, 2018
.github feat(core): 1st commit Nov 9, 2017
aedatastore docs(all): cleanup obsolete TODO comment May 30, 2018
aeprodtest refactor(all): apply `gofmt -s` and `misspell` Jun 6, 2018
boom feat(boom): add DatastoreTransaction function to boom package Sep 13, 2018
clouddatastore feat(cloud): add FromClient function Oct 22, 2018
dsmiddleware fix(dsmiddleware/storagecache): fix panic occurred when DeleteMulti r… Aug 12, 2018
internal feat(core): updatet dependencies Aug 12, 2018
testbed feat(core): updatet dependencies Aug 12, 2018
testsuite refactor(all): apply `gofmt -s` and `misspell` Jun 6, 2018
.gitignore chore(core): add .DS_Store to .gitignore Dec 15, 2017
CHANGELOG.md docs(core): generate CHANGELOG.md Oct 23, 2018
CONTRIBUTING.md feat(core): 1st commit Nov 9, 2017
Gopkg.lock feat(core): update dependencies Oct 22, 2018
Gopkg.toml feat(core): updatet dependencies Aug 12, 2018
LICENSE doc(license): Split our license and Google's license Nov 9, 2017
LICENSE.google docs(core): write godoc comment to batch.go Mar 27, 2018
LICENSE.goon chore(boom): add LICENSE.goon Nov 14, 2017
README.md docs(core): update README.md Jun 6, 2018
app.yaml feat(ci): update CI and local testing environment Mar 22, 2018
batch.go feat(core): add lock to *Batch#Exec Aug 12, 2018
build-in-docker.sh feat(core): 1st commit Nov 9, 2017
caches.go docs(core): write godoc comment to all .go files May 18, 2018
doc.go docs(core): add repository url to godoc Jun 6, 2018
doc_ja.go docs(core): write doc.go in english May 29, 2018
docker-compose.yml feat(core): update dependencies Oct 22, 2018
errors.go docs(core): write godoc comment to all .go files May 18, 2018
example_test.go fix(ci): fix ci failed May 30, 2018
export.go docs(core): write godoc comment to all .go files May 18, 2018
interfaces.go feat(core): deprecate datastore.FromContext and related API May 30, 2018
load.go fix(core): fix datastore.Key or []datastore.Key Save & Load handling Nov 22, 2017
option.go docs(core): write godoc comment to all .go files May 18, 2018
package-lock.json feat(core): update dependencies May 18, 2018
package.json docs(core): generate CHANGELOG.md Oct 23, 2018
prop.go docs(core): write godoc comment to all .go files May 18, 2018
prop_test.go refactor(all): apply `gofmt -s` and `misspell` Jun 6, 2018
query.go feat(core): 1st commit Nov 9, 2017
save.go fix(core): fix time.Time's default location. fit to Cloud Datastore b… Dec 5, 2017
serve.sh test(core): use docker-compose at test in local env Dec 19, 2017
setup.sh feat(ci): change golint repository May 24, 2018
test.sh feat(core): deprecate datastore.FromContext and related API May 30, 2018
time.go fix(core): fix time.Time's default location. fit to Cloud Datastore b… Dec 5, 2017
tx_batch.go refactor(all): apply `gofmt -s` and `misspell` Jun 6, 2018

README.md

Datastore Wrapper Go Documentation CircleCI

(AppEngine | Cloud) Datastore wrapper for Go 👉

Simple. Happy. Respect standard library.

$ go get -u go.mercari.io/datastore

Feature

DO

  • Wrap google.golang.org/appengine/datastore and cloud.google.com/go/datastore
    • keep key behavior
    • align to cloud.google.com/go/datastore first
  • Re-implement datastore package
  • Re-implement datastore.SaveStruct & LoadStruct
    • Ignore unmapped property
    • Add PropertyTranslator interface
      • Convert types like mytime.Unix to time.Time and reverse it
      • Rename property like CreatedAt to createdAt or created_at and reverse it
  • Re-implement PropertyLoadSaver
    • Pass context.Context to Save & Load method
  • Add retry feature to each RPC
    • e.g. Retry AllocateID when it failed
  • Add middleware layer
    • About...
      • Local Cache
      • AE Memcache
      • Logging
      • Retry
      • etc...
    • Easy to ON/OFF switching
  • Add some useful methods
    • aedatastore/TransactionContext

DON'T

  • have utility functions
  • support firestore

Restriction

  • aedatastore package
    • When using slice of struct, MUST specified datastore:",flatten" option.
      • original (ae & cloud) datastore.SaveStruct have different behaviors.
      • see aeprodtest/main.go /api/test3

Committers

Contribution

Please read the CLA below carefully before submitting your contribution.

https://www.mercari.com/cla/

Setup environment & Run tests

  • requirements
    • gcloud sdk
      • gcloud components install app-engine-go
      • gcloud components install beta cloud-datastore-emulator
    • dep
      • go get -u github.com/golang/dep/cmd/dep
  1. Testing in local
$ ./setup.sh # exec once
$ ./serve.sh # exec in background
$ ./test.sh
  1. Testing with Circle CI CLI
$ circleci build

License

Copyright 2017 Mercari, Inc.

Licensed under the MIT License.