# README
Datastore Wrapper

:construction: This package is unstable :construction: github repo
(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
andcloud.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
- It can catch entity from the cache layers as well as from the datastore
- Add retry feature to each RPC
- e.g. Retry AllocateID when it failed
- Add cache layer
- About...
- Local Cache
- AE Memcache
- etc...
- Easy to ON/OFF switching
- About...
- 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
- When using slice of struct, MUST specified
How To Use
TODO
Best Practice
TODO
Project Navigation
aedatastore
- Datastore Wrapper implementation for AppEngine Datastore
aeprodtest
- Test code that works in AppEngine production environment
boom
- goon likes interface for this package
cache
- Implementation of cache layer strategies
cache/aememcache
- Entity caching with AE Memcache
cache/dslog
- Datastore operation logging in cache layer
cache/fishbone
- Replace query by KeysOnly query with Get ops
cache/localcache
- Entity caching with machine local memory
cache/storagecache
- Entity cacheing base code
clouddatastore
- Datastore Wrapper implementation for Cloud Datastore
internal
- internal package
testbed
- Testbed to check the behavior of AE Datastore and Cloud Datastore
testsuite
- Test suite for this package
TODO
- Write tests for namespace
- Retry feature
- Write more documents
Committers
- Masahiro Wakame (@vvakame)
Contribution
Please read the CLA below carefully before submitting your contribution.
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
- gcloud sdk
- Testing in local
$ ./setup.sh # exec once
$ ./serve.sh # exec in background
$ ./test.sh
- Testing with Docker
$ ./build-in-docker.sh
- Testing with Circle CI CLI
$ circleci build
License
Copyright 2017 Mercari, Inc.
Licensed under the MIT License.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
LoadStruct loads the properties from p to dst.
SaveStruct returns the properties from src as a slice of Properties.
WithCredentialsFile returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials file.
WithHTTPClient returns a ClientOption that specifies the HTTP client to use as the basis of communications.
No description provided by the author
WithScopes returns a ClientOption that overrides the default OAuth2 scopes to be used for a service.
WithTokenSource returns a ClientOption that specifies an OAuth2 token source to be used as the basis for authentication.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TODO hide LoadEntity project outside.
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
ErrFieldMismatch is returned when a field is to be loaded into a different type than the one it was stored from, or when a field is missing or unexported in the destination struct.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
MultiError is returned by batch operations when there are errors with particular elements.
No description provided by the author