Documentation
¶
Overview ¶
Package datastore provides a set of functions to interact with Google Cloud Datastore.
It allows for operations such as creating a new client, saving a URL entity, retrieving a URL entity by its ID, and closing the client connection. This version has been updated to use the zap logger for consistent and structured logging.
Copyright (c) 2023 H0llyW00dzZ
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("datastore: no such entity")
ErrNotFound is the error returned when a requested entity is not found in the datastore.
var Logger *zap.Logger
Logger is a package-level variable to access the zap logger throughout the datastore package. It is intended to be used by other functions within the package for logging purposes.
Functions ¶
func CloseClient ¶
CloseClient closes the Datastore client. It should be called to clean up resources and connections when the client is no longer needed. Returns an error if the client could not be closed.
func CreateContext ¶
CreateContext creates a new context that can be used for Datastore operations. It returns a non-nil, empty context.
Types ¶
type Client ¶ added in v0.1.5
type Client struct {
*cloudDatastore.Client
}
Client wraps the cloudDatastore.Client to abstract away the underlying implementation.
func CreateDatastoreClient ¶
CreateDatastoreClient creates a new client connected to Google Cloud Datastore. It requires a context and a projectID to initialize the connection. Returns a new Datastore client or an error if the connection could not be established.