Documentation
¶
Overview ¶
Package tips contains tips for writing Cloud Functions in Go.
Package tips contains tips for writing Cloud Functions in Go.
Package tips contains tips for writing Cloud Functions in Go.
Package tips contains tips for writing Cloud Functions in Go.
Package tips contains tips for writing Cloud Functions in Go.
Package tips contains tips for writing Cloud Functions in Go.
Index ¶
- func EnvVar(w http.ResponseWriter, r *http.Request)
- func FailedWriteOperation(client interface{}, data string) error
- func HTTPError(w http.ResponseWriter, r *http.Request)
- func LazyGlobal(w http.ResponseWriter, r *http.Request)
- func ListFiles(w http.ResponseWriter, r *http.Request)
- func MisconfiguredDataClient() (interface{}, error)
- func RetryPubSub(ctx context.Context, m PubSubMessage) error
- func ScopeDemo(w http.ResponseWriter, r *http.Request)
- func Timeout(w http.ResponseWriter, r *http.Request)
- type PubSubMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvVar ¶
func EnvVar(w http.ResponseWriter, r *http.Request)
EnvVar is an example of getting an environment variable in a Go function.
func FailedWriteOperation ¶
FailedWriteOperation simulates failure to write data via the provided client
func HTTPError ¶
func HTTPError(w http.ResponseWriter, r *http.Request)
HTTPError describes how errors are handled in an HTTP function.
func LazyGlobal ¶
func LazyGlobal(w http.ResponseWriter, r *http.Request)
LazyGlobal is an example of lazily initializing a Google Cloud Storage client.
func ListFiles ¶
func ListFiles(w http.ResponseWriter, r *http.Request)
ListFiles lists the files in the current directory. Uses directory "serverless_function_source_code" as defined in the Go Functions Framework Buildpack. See https://github.com/GoogleCloudPlatform/buildpacks/blob/56eaad4dfe6c7bd0ecc4a175de030d2cfab9ae1c/cmd/go/functions_framework/main.go#L38.
func MisconfiguredDataClient ¶
func MisconfiguredDataClient() (interface{}, error)
MisconfiguredDataClient simulates failure to retrieve a data storage client.
func RetryPubSub ¶
func RetryPubSub(ctx context.Context, m PubSubMessage) error
RetryPubSub demonstrates how to toggle using retries.
Types ¶
type PubSubMessage ¶
type PubSubMessage struct {
Data []byte `json:"data"`
}
PubSubMessage is the payload of a Pub/Sub event. See the documentation for more details: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage