datastoreutils

package
v5.2.0--beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EntityUsers       = "users"
	EntityCards       = "card"
	EntityCompanyInfo = "companyInfo"
	EntityAppSettings = "appSettings"
)

these are the names of the entity types in the Google Cloud Datastore entity types are like tables variables, not constants, because we can edit them in SetConfig

View Source
var Config = config{
	ProjectID:   "",
	Development: false,
}

Config is a copy of the config struct with some defaults set

Functions

func Connect

func Connect(c context.Context) (client *datastore.Client, err error)

Connect connects to the datastore

func GetKeyFromID

func GetKeyFromID(entityType string, id int64) *datastore.Key

GetKeyFromID gets the full datastore key from the datastore id for a given entity type id is a numeric value generated automatically by the datastore

func GetKeyFromName

func GetKeyFromName(entityType, keyName string) *datastore.Key

GetKeyFromName gets the full datastore key from the key's name for a given entity type name is an alphanumeric value we provide

func GetNewIncompleteKey

func GetNewIncompleteKey(entityType string) *datastore.Key

GetNewIncompleteKey generates a new incomplete key for an entity being saved to the datastore for a given entity type

func SetConfig

func SetConfig(c config) error

SetConfig saves the configuration for the datastore

Types

This section is empty.

Jump to

Keyboard shortcuts

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