tips

package module
v0.0.0-...-4badc5a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

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

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

func FailedWriteOperation(client interface{}, data string) error

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.

func ScopeDemo

func ScopeDemo(w http.ResponseWriter, r *http.Request)

ScopeDemo is an example of using globally and locally scoped variables in a function.

func Timeout

func Timeout(w http.ResponseWriter, r *http.Request)

Timeout sleeps for 2 minutes and may time out before finishing.

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

Directories

Path Synopsis
contexttip module

Jump to

Keyboard shortcuts

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