Documentation ¶
Index ¶
- func CallJob(ctx context.Context, job *proto.Job, inputs map[string]any, ...) 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 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 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 )
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 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 ¶
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.