nds

package module
v0.0.0-...-e7a046a Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2021 License: MIT Imports: 4 Imported by: 0

README

Google Cloud Datastore Go utility clients

⚠️ This package is still in the design phase, with no working code yet. I am still looking for interest, input, and help on this package

Approximately source-compatible implementations of the Google Cloud Datastore API Go package, with alternative and middleware implementations for unit testing, caching, ... Offers many features of the ndb package, and more.

Client implementations:

  • Datastore: Passthrough to the cloud.google.com/datastore package, for the actual connection to Google Cloud Datastore.
  • Memory: in-memory implementation, for use in unit tests
  • Cache: Middleware client that caches entities locally (in the current request context) and/or globally (e.g. in Redis or global memory), similar to the local and global cache of the ndb package.

This package also provides utility functions for working with the datastore:

  • Functions to safely load and save incomplete structs from datastore. This avoids data loss when working with structs that do not perfectly map to the datastore (e.g. when working with legacy data or other clients)

Documentation

Documentation

Overview

Package nds provides Google Cloud Datastore utility clients

Index

Constants

This section is empty.

Variables

View Source
var ErrFieldMismatch = errors.New("field mismatch")
View Source
var ErrInvalidID = errors.New("invalid id")
View Source
var ErrInvalidKey = errors.New("invalid key")
View Source
var ErrNotFound = errors.New("not found")
View Source
var IncompleteKey = datastore.IncompleteKey
View Source
var IteratorDone = iterator.Done

Functions

This section is empty.

Types

type Cursor

type Cursor = datastore.Cursor

type DB

type DB interface {
	NewQuery(kind string) Query

	Get(ctx context.Context, key *Key, dst interface{}) (err error)
	Put(ctx context.Context, key *Key, src interface{}) (*Key, error)
	Run(ctx context.Context, q Query) Iterator
}

Driver implementation. This implements the global functions of the `cloud.google.com/go/datastore` package.

type Iterator

type Iterator interface {
	Cursor() (c Cursor, err error)
	Next(dst interface{}) (k *Key, err error)
}

Abstract interfaces for datastore types

type Key

type Key = datastore.Key

Primitive types directly taken from `cloud.google.com/go/datastore`

type Query

type Query interface {
	Filter(filterStr string, value interface{}) Query
	Start(c Cursor) Query
	Limit(limit int) Query
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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