github.com/instill-ai/component@v0.16.0-beta/pkg/connector/airbyte/v0/main.go (about) 1 package airbyte 2 3 import ( 4 _ "embed" 5 "fmt" 6 "sync" 7 8 "go.uber.org/zap" 9 "google.golang.org/protobuf/types/known/structpb" 10 11 "github.com/instill-ai/component/pkg/base" 12 ) 13 14 //go:embed config/definition.json 15 var definitionJSON []byte 16 17 //go:embed config/tasks.json 18 var tasksJSON []byte 19 20 var once sync.Once 21 var con *connector 22 23 type connector struct { 24 base.BaseConnector 25 } 26 27 type execution struct { 28 base.BaseConnectorExecution 29 } 30 31 func Init(l *zap.Logger, u base.UsageHandler) *connector { 32 once.Do(func() { 33 con = &connector{ 34 BaseConnector: base.BaseConnector{ 35 Logger: l, 36 UsageHandler: u, 37 }, 38 } 39 err := con.LoadConnectorDefinition(definitionJSON, tasksJSON, nil) 40 if err != nil { 41 panic(err) 42 } 43 }) 44 return con 45 } 46 47 func (c *connector) CreateExecution(sysVars map[string]any, connection *structpb.Struct, task string) (*base.ExecutionWrapper, error) { 48 return &base.ExecutionWrapper{Execution: &execution{ 49 BaseConnectorExecution: base.BaseConnectorExecution{Connector: c, SystemVariables: sysVars, Connection: connection, Task: task}, 50 }}, nil 51 } 52 53 func (e *execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error) { 54 return nil, fmt.Errorf("the Airbyte connector has been removed") 55 } 56 57 func (c *connector) Test(sysVars map[string]any, connection *structpb.Struct) error { 58 return fmt.Errorf("the Airbyte connector has been removed") 59 }