gcd

package
Version: v0.0.0-...-88f93cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	NewClient(ctx context.Context, projectID string) (*datastore.Client, error)
}

Backend is an abstraction over {Local, Prod}Datastore that allows callers to construct a new client without having to know about whether it's local.

type LocalBackend

type LocalBackend struct {
	// contains filtered or unexported fields
}

LocalBackend represents an emulated Google Cloud Datastore running on localhost

func NewLocalBackend

func NewLocalBackend() (db LocalBackend, shutdown func() error, err error)

NewLocalBackend spawns a new LocalBackend using Java. When there is no error, make sure to call shutdown() in order to terminate the Java process.

func (LocalBackend) NewClient

func (db LocalBackend) NewClient(ctx context.Context, projectID string) (*datastore.Client, error)

NewClient constructs a datastore client for the emulated LocalBackend. The constructed client will work offline and never connect to the wide internet.

func (LocalBackend) Reset

func (db LocalBackend) Reset() error

Reset resets the local backend to an empty database.

type ProdBackend

type ProdBackend struct{}

ProdBackend represents the production instance of Google Cloud Datastore

func NewProdBackend

func NewProdBackend() (db ProdBackend)

NewProdBackend constructs a new ProdBackend.

func (ProdBackend) NewClient

func (db ProdBackend) NewClient(ctx context.Context, projectID string) (*datastore.Client, error)

NewClient is a wrapper around the default implementation of datastore.NewClient(), calling out to the real, live Google Cloud Datastore.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL