faas

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Request - HTTP Request Source Type
	Request SourceType = "REQUEST"
	// Subscription - Topic Subscription Source Type
	Subscription = "SUBSCRIPTION"
	// Unknown - Unknown Source Types, used when the source can't be determined.
	Unknown = "UNKNOWN"
)

Variables

This section is empty.

Functions

func Start

func Start(f NitricFunction) error

Start - Starts accepting requests for the provided NitricFunction

This should be the only method called in the 'main' method of your entrypoint package

Types

type NitricContext

type NitricContext struct {
	// contains filtered or unexported fields
}

NitricContext - Represents the contextual metadata for a Nitric function request.

func (*NitricContext) GetPayloadType

func (c *NitricContext) GetPayloadType() string

GetPayloadType - return the payload type of the request payload. Typically a typehint.

func (*NitricContext) GetRequestID

func (c *NitricContext) GetRequestID() string

GetRequestID - return the request id of the request.

func (*NitricContext) GetSource

func (c *NitricContext) GetSource() string

GetSource - return the source of the request.

func (*NitricContext) GetSourceType

func (c *NitricContext) GetSourceType() SourceType

GetSourceType - return the source type of the request

type NitricFunction

type NitricFunction func(*NitricRequest) *NitricResponse

NitricFunction - a function built using Nitric, to be executed

type NitricRequest

type NitricRequest struct {
	// contains filtered or unexported fields
}

NitricRequest - represents a request to trigger a function, with payload and context required to execute that function.

func (*NitricRequest) GetContext

func (n *NitricRequest) GetContext() NitricContext

GetContext - return the context of a request, with metadata about that request.

func (*NitricRequest) GetPayload

func (n *NitricRequest) GetPayload() []byte

GetPayload - return the []byte payload of the request.

func (*NitricRequest) GetStruct

func (n *NitricRequest) GetStruct(object interface{}) error

GetStruct - Unmarshals the request body from JSON to the provided interface{}

type NitricResponse

type NitricResponse struct {
	Headers map[string]string
	Status  int
	Body    []byte
}

NitricResponse - represents the results of calling a function.

type SourceType

type SourceType string

SourceType - enum of the possible sources for a Nitric request.

func (SourceType) String

func (p SourceType) String() string

Jump to

Keyboard shortcuts

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