Documentation
¶
Index ¶
- func CallJob(ctx context.Context, job *proto.Job, inputs map[string]any, ...) error
- func CallPredefinedHook(ctx context.Context, hook config.FunctionHook) error
- func CallRoute(ctx context.Context, handler string, body *RouteRequest) (*RouteResponse, *FunctionsRuntimeMeta, error)
- func CallSubscriber(ctx context.Context, subscriber *proto.Subscriber, event *events.Event) error
- func WithFunctionsTransport(ctx context.Context, transport Transport) context.Context
- type Default
- type FunctionErrorCode
- type FunctionType
- type FunctionsRuntimeError
- type FunctionsRuntimeMeta
- type FunctionsRuntimeRequest
- type FunctionsRuntimeResponse
- type HttpFunctionsClient
- type RouteRequest
- type RouteResponse
- type StaticAnalyser
- type StaticAnalysisResult
- type Transport
- type TriggerType
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 CallPredefinedHook ¶ added in v0.389.0
func CallPredefinedHook(ctx context.Context, hook config.FunctionHook) error
func CallRoute ¶ added in v0.408.0
func CallRoute(ctx context.Context, handler string, body *RouteRequest) (*RouteResponse, *FunctionsRuntimeMeta, error)
func CallSubscriber ¶
CallSubscriber will invoke the subscriber function on the runtime node server.
Types ¶
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 BadRequestError FunctionErrorCode = -32009 InternalError FunctionErrorCode = -32010 )
type FunctionType ¶
type FunctionType string
const ( ActionFunction FunctionType = "action" JobFunction FunctionType = "job" SubscriberFunction FunctionType = "subscriber" FlowFunction FunctionType = "flow" RouteFunction FunctionType = "route" )
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 CallFlow ¶ added in v0.413.1
func CallFlow(ctx context.Context, flow *proto.Flow, runId string, data map[string]any) (any, *FunctionsRuntimeMeta, error)
CallFlow will invoke the flow function on the runtime node server.
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 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 RouteRequest ¶ added in v0.408.0
type RouteResponse ¶ added in v0.408.0
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 ¶
type Transport func(ctx context.Context, req *FunctionsRuntimeRequest) (*FunctionsRuntimeResponse, error)
func NewHttpTransport ¶
type TriggerType ¶
type TriggerType string
const ( ManualTrigger TriggerType = "manual" ScheduledTrigger TriggerType = "scheduled" )
Click to show internal directories.
Click to hide internal directories.