base

package
v0.6.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const OpenAPITemplate = `` /* 1538-byte string literal not displayed */

Variables

This section is empty.

Functions

func ConvertFromStructpb

func ConvertFromStructpb(from *structpb.Struct, to interface{}) error

func ConvertToStructpb

func ConvertToStructpb(from interface{}) (*structpb.Struct, error)

Types

type Component

type Component struct {
	Name string

	// Logger
	Logger *zap.Logger
	// contains filtered or unexported fields
}

func (*Component) GetTaskInputSchemas

func (comp *Component) GetTaskInputSchemas() map[string]string

func (*Component) GetTaskOutputSchemas

func (comp *Component) GetTaskOutputSchemas() map[string]string

type Connector

type Connector struct {
	Component
	// contains filtered or unexported fields
}

func (*Connector) AddConnectorDefinition

func (c *Connector) AddConnectorDefinition(def *connectorPB.ConnectorDefinition) error

func (*Connector) GetConnectorDefinitionByID

func (c *Connector) GetConnectorDefinitionByID(defID string) (*connectorPB.ConnectorDefinition, error)

func (*Connector) GetConnectorDefinitionByUID

func (c *Connector) GetConnectorDefinitionByUID(defUID uuid.UUID) (*connectorPB.ConnectorDefinition, error)

func (*Connector) IsCredentialField

func (c *Connector) IsCredentialField(defID string, target string) bool

func (*Connector) ListConnectorDefinitions

func (c *Connector) ListConnectorDefinitions() []*connectorPB.ConnectorDefinition

func (*Connector) ListCredentialField

func (c *Connector) ListCredentialField(defID string) ([]string, error)

func (*Connector) LoadConnectorDefinitions

func (c *Connector) LoadConnectorDefinitions(definitionsJsonBytes []byte, tasksJsonBytes []byte) error

type Execution

type Execution struct {
	Logger             *zap.Logger
	Component          IComponent
	ComponentExecution IExecution
	UID                uuid.UUID
	Config             *structpb.Struct
	Task               string
}

func CreateExecutionHelper

func CreateExecutionHelper(e IExecution, comp IComponent, defUID uuid.UUID, task string, config *structpb.Struct, logger *zap.Logger) Execution

func (*Execution) ExecuteWithValidation

func (e *Execution) ExecuteWithValidation(inputs []*structpb.Struct) ([]*structpb.Struct, error)

func (*Execution) GetConfig

func (e *Execution) GetConfig() *structpb.Struct

func (*Execution) GetTask

func (e *Execution) GetTask() string

func (*Execution) GetUID

func (e *Execution) GetUID() uuid.UUID

func (*Execution) Validate

func (e *Execution) Validate(data []*structpb.Struct, jsonSchema string) error

type IComponent

type IComponent interface {

	// Create a execution by definition uid and component configuration
	CreateExecution(defUID uuid.UUID, task string, config *structpb.Struct, logger *zap.Logger) (IExecution, error)

	// Get task input schemas
	GetTaskInputSchemas() map[string]string
	// Get task output schemas
	GetTaskOutputSchemas() map[string]string
	// contains filtered or unexported methods
}

All component need to implement this interface

type IConnector

type IConnector interface {
	IComponent

	// Functions that need to be implemented for all connectors
	// Test connection
	Test(defUID uuid.UUID, config *structpb.Struct, logger *zap.Logger) (connectorPB.ConnectorResource_State, error)

	// Functions that shared for all connectors
	// Load connector definitions from json files
	LoadConnectorDefinitions(definitionsJson []byte, tasksJson []byte) error
	// Add definition
	AddConnectorDefinition(def *connectorPB.ConnectorDefinition) error
	// Get the connector definition by definition uid
	GetConnectorDefinitionByUID(defUID uuid.UUID) (*connectorPB.ConnectorDefinition, error)
	// Get the connector definition by definition id
	GetConnectorDefinitionByID(defID string) (*connectorPB.ConnectorDefinition, error)
	// Get the list of connector definitions under this connector
	ListConnectorDefinitions() []*connectorPB.ConnectorDefinition

	// List the CredentialFields by definition id
	ListCredentialField(defID string) ([]string, error)
	// A helper function to check the target field a.b.c is credential
	IsCredentialField(defID string, target string) bool
}

`IConnector` define the function interface for all connectors.

type IExecution

type IExecution interface {
	// Functions that shared for all connectors
	// Validate the input and output format
	Validate(data []*structpb.Struct, jsonSchema string) error

	// Execute
	GetTask() string
	GetConfig() *structpb.Struct
	GetUID() uuid.UUID

	// Execute
	ExecuteWithValidation(inputs []*structpb.Struct) ([]*structpb.Struct, error)
	// execute
	Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error)
}

type IOperator

type IOperator interface {
	IComponent

	// Functions that shared for all operators
	// Load operator definitions from json files
	LoadOperatorDefinitions(definitionsJson []byte, tasksJson []byte) error
	// Add definition
	AddOperatorDefinition(def *pipelinePB.OperatorDefinition) error
	// Get the operator definition by definition uid
	GetOperatorDefinitionByUID(defUID uuid.UUID) (*pipelinePB.OperatorDefinition, error)
	// Get the operator definition by definition id
	GetOperatorDefinitionByID(defID string) (*pipelinePB.OperatorDefinition, error)
	// Get the list of operator definitions under this operator
	ListOperatorDefinitions() []*pipelinePB.OperatorDefinition
}

`IOperator` define the function interface for all operators.

type Operator

type Operator struct {
	Component
}

func (*Operator) AddOperatorDefinition

func (o *Operator) AddOperatorDefinition(def *pipelinePB.OperatorDefinition) error

func (*Operator) GetOperatorDefinitionByID

func (o *Operator) GetOperatorDefinitionByID(defID string) (*pipelinePB.OperatorDefinition, error)

func (*Operator) GetOperatorDefinitionByUID

func (o *Operator) GetOperatorDefinitionByUID(defUID uuid.UUID) (*pipelinePB.OperatorDefinition, error)

func (*Operator) ListOperatorDefinitions

func (o *Operator) ListOperatorDefinitions() []*pipelinePB.OperatorDefinition

func (*Operator) LoadOperatorDefinitions

func (o *Operator) LoadOperatorDefinitions(definitionsJsonBytes []byte, tasksJsonBytes []byte) error

Jump to

Keyboard shortcuts

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