datastore

package module
v0.0.0-...-44bc79e Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

README

datastore [DEPRECATED]

Compatability layer between the appengine and cloud datastore libraries.

Installation

Documentation

Overview

Package datastore provides a client for Google Cloud Datastore that works both on App Engine and in stand alone applications.

This package is a thin wrapper or compatibility layer for cloud.google.com/go/datastore and google.golang.org/appengine/datastore. The documentation for this project is purposely very light, with a recommendation that you normally should just follow the documentation for https://godoc.org/cloud.google.com/go/datastore.

I have only really created wrappers around the functionality I use, but overtime I expect this to be a complete wrapper. Pull requests are welcomed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	IDKey(kind string, id int64, parent Key) Key
	IncompleteKey(kind string, parent Key) Key
	NameKey(kind, name string, parent Key) Key

	Delete(key Key) error
	DeleteMulti(keys []Key) error
	Get(key Key, dst interface{}) error
	GetAll(q Query, dst interface{}) ([]Key, error)
	GetMulti(keys []Key, dst interface{}) error
	Put(key Key, src interface{}) (Key, error)
	PutMulti(keys []Key, src interface{}) ([]Key, error)
	Run(query Query) Iterator

	NewQuery(kind string) Query

	Close() error
}

Client is a client for reading and writing data in a datastore dataset.

func NewCloudClient

func NewCloudClient(projectID string) (Client, error)

NewCloudClient creates a datastore client for use outside of Google App Engine.

func NewGaeClient

func NewGaeClient(ctx context.Context) Client

NewGaeClient creates a datastore client for use in Google App Engine.

type Iterator

type Iterator interface {
	Next(dst interface{}) (Key, error)
}

Iterator is the result of running a query.

type Key

type Key interface {
	GetID() int64
	GetName() string
	// contains filtered or unexported methods
}

Key represents the datastore key for a stored entity.

type Query

type Query interface {
	Ancestor(ancestor Key) Query
	Distinct() Query
	EventualConsistency() Query
	Filter(filterStr string, value interface{}) Query
	Limit(limit int) Query
	Offset(offset int) Query
	Order(fieldName string) Query
	// contains filtered or unexported methods
}

Query represents a datastore query.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL