functions

package
v0.379.2-next.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallJob

func CallJob(ctx context.Context, job *proto.Job, inputs map[string]any, permissionState *common.PermissionState, trigger TriggerType) error

CallJob will invoke the job function on the runtime node server.

func CallSubscriber

func CallSubscriber(ctx context.Context, subscriber *proto.Subscriber, event *events.Event) error

CallSubscriber will invoke the subscriber function on the runtime node server.

func WithFunctionsTransport

func WithFunctionsTransport(ctx context.Context, transport Transport) context.Context

Types

type Default

type Default struct {
}

type FunctionErrorCode

type FunctionErrorCode int

Custom error codes returned from custom function runtime See packages/functions-runtime for original definition and more info.

const (
	UnknownError              FunctionErrorCode = -32001
	DatabaseError             FunctionErrorCode = -32002
	NoResultError             FunctionErrorCode = -32003
	RecordNotFoundError       FunctionErrorCode = -32004
	ForeignKeyConstraintError FunctionErrorCode = -32005
	NotNullConstraintError    FunctionErrorCode = -32006
	UniqueConstraintError     FunctionErrorCode = -32007
	PermissionError           FunctionErrorCode = -32008
)

type FunctionType

type FunctionType string
const (
	ActionFunction     FunctionType = "action"
	JobFunction        FunctionType = "job"
	SubscriberFunction FunctionType = "subscriber"
)

type FunctionsRuntimeError

type FunctionsRuntimeError struct {
	Code    FunctionErrorCode `json:"code"`
	Message string            `json:"message"`

	// Data represents any additional error metadata that the functions-runtime want to send in addition to the error code + message
	Data map[string]any `json:"data"`
}

FunctionsRuntimeError follows the error object specification from the JSONRPC spec: https://www.jsonrpc.org/specification#error_object

type FunctionsRuntimeMeta

type FunctionsRuntimeMeta struct {
	Headers map[string][]string `json:"headers"`
	Status  int                 `json:"status"`
}

func CallFunction

func CallFunction(ctx context.Context, actionName string, body any, permissionState *common.PermissionState) (any, *FunctionsRuntimeMeta, error)

CallFunction will invoke the custom function on the runtime node server.

type FunctionsRuntimeRequest

type FunctionsRuntimeRequest struct {
	ID     string         `json:"id"`
	Method string         `json:"method"`
	Type   FunctionType   `json:"type"`
	Params any            `json:"params"`
	Meta   map[string]any `json:"meta"`
}

type FunctionsRuntimeResponse

type FunctionsRuntimeResponse struct {
	ID     string                 `json:"id"`
	Result any                    `json:"result"`
	Meta   *FunctionsRuntimeMeta  `json:"meta"`
	Error  *FunctionsRuntimeError `json:"error"`
}

type HttpFunctionsClient

type HttpFunctionsClient struct {
	URL string
}

type StaticAnalyser

type StaticAnalyser struct {
	Workdir string

	Result StaticAnalysisResult
}

func NewStaticAnalyser

func NewStaticAnalyser(workdir string) *StaticAnalyser

func (*StaticAnalyser) Analyse

func (a *StaticAnalyser) Analyse() error

type StaticAnalysisResult

type StaticAnalysisResult struct {
	Default Default `json:"default"`
}

type Transport

func NewHttpTransport

func NewHttpTransport(url string) Transport

type TriggerType

type TriggerType string
const (
	ManualTrigger    TriggerType = "manual"
	ScheduledTrigger TriggerType = "scheduled"
)

Jump to

Keyboard shortcuts

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