Giter VIP home page Giter VIP logo

go-functions-sdk's Introduction

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

package funcpackage

import (
	"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 authentication

More coming soon.

Install the deployment tool

gcloud auth login
gcloud config set project <project-id>

go 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

go-functions-sdk's People

Contributors

dergoegge avatar rgo3 avatar

Watchers

 avatar

Forkers

rgo3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.