events

package
v0.0.0-...-88e5de2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(handler func(*Event) error) http.HandlerFunc

Handler returns http.Handler that parses the body for a function event.

Types

type Event

type Event struct {
	Context EventContext
	Data    json.RawMessage
}

Event is the basic data structure passed to functions by non-HTTP triggers.

func (*Event) PubSubMessage

func (e *Event) PubSubMessage() (*PubSubMessage, error)

PubSubMessage unmarshals the event data as a pub sub message.

func (*Event) StorageObject

func (e *Event) StorageObject() (*StorageObject, error)

StorageObject unmarshals the event data as a storage event.

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(b []byte) error

UnmarshalJSON parses a JSON string to time.Time.

type EventContext

type EventContext struct {
	EventID   string `json:"eventId"`
	Timestamp JSTime `json:"timestamp"`
	EventType string `json:"eventType"`
	Resource  string `json:"resource"`
}

EventContext holds the data associated with the event that triggered the execution of the function along with metadata of the event itself.

type JSTime

type JSTime struct {
	time.Time
}

JSTime is a wrapper for time.Time to decode the time from Javascript.

func (*JSTime) UnmarshalJSON

func (t *JSTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON parses a JSON string to time.Time.

type PubSubMessage

type PubSubMessage struct {
	pubsub.PubsubMessage

	Data []byte
}

PubSubMessage is a wrapper for pubsub.PubsubMessage.

type StorageObject

type StorageObject struct {
	storage.Object
}

StorageObject is a wrapper for storage.Object.

Jump to

Keyboard shortcuts

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