Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dergoegge/go-functions-sdk
Golang cloud functions sdk
https://github.com/dergoegge/go-functions-sdk
cloud-functions golang google-cloud
Last synced: 8 days ago
JSON representation
Golang cloud functions sdk
- Host: GitHub
- URL: https://github.com/dergoegge/go-functions-sdk
- Owner: dergoegge
- License: apache-2.0
- Created: 2019-04-10T15:40:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-01T11:29:54.000Z (over 5 years ago)
- Last Synced: 2023-12-18T05:27:55.615Z (11 months ago)
- Topics: cloud-functions, golang, google-cloud
- Language: Go
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Importer beware this is a **WORK IN PROGRESS**
# Unofficial golang cloud functions sdk
This projects aims to simplify the deployment process of golang cloud functions.
Code the functions and deploy with `gocf deploy`.
## Install the functions package
```
go get github.com/dergoegge/go-functions-sdk
```## Function examples
```golang
package funcpackageimport (
"context"
"fmt"
"net/http""github.com/dergoegge/go-functions-sdk/pkg/functions"
)var HTTPFuncName = functions.New().
RunWith(functions.RuntimeOptions{
Timeout: 70, // Timeout in seconds
Memory: "128MB",
}).
Region("us-central1").
RetryOnFailure(true).
OnRequest(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Yeet")
})var FirestoreFuncName = functions.New().
RunWith(functions.RuntimeOptions{
Timeout: 70,
Memory: "1GB",
}).
Region("europe-west2").
Firestore().
Document("some-collection/{docID}").
OnWrite(func(ctx context.Context, event functions.FirestoreEvent) error {
fmt.Println(event.Value.Fields)
return nil
})```
More examples for different trigger types are located in the `examples` directory.
## Supported trigger types
* Http
* Firestore
* Storage
* PubSub
* Firebase authenticationMore coming soon.
## Install the deployment tool
```sh
gcloud auth login
gcloud config set projectgo install github.com/dergoegge/go-functions-sdk/cmd/gocf
```## Comands
Deploy cloud functions:
`gocf deploy [--only "comma seperated list of functions to deploy"]`List deployed cloud functions:
`gocf list`