github.com/instill-ai/component@v0.16.0-beta/pkg/operator/end/v0/main.go (about) 1 package end 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 *operator 22 23 type operator struct { 24 base.BaseOperator 25 } 26 27 type execution struct { 28 base.BaseOperatorExecution 29 } 30 31 func Init(l *zap.Logger, u base.UsageHandler) *operator { 32 once.Do(func() { 33 con = &operator{ 34 BaseOperator: base.BaseOperator{ 35 Logger: l, 36 UsageHandler: u, 37 }, 38 } 39 err := con.LoadOperatorDefinition(definitionJSON, tasksJSON, nil) 40 if err != nil { 41 panic(err) 42 } 43 }) 44 return con 45 } 46 47 func (o *operator) CreateExecution(sysVars map[string]any, task string) (*base.ExecutionWrapper, error) { 48 return &base.ExecutionWrapper{Execution: &execution{ 49 BaseOperatorExecution: base.BaseOperatorExecution{Operator: o, SystemVariables: sysVars, Task: task}, 50 }}, nil 51 } 52 53 func (e *execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error) { 54 return nil, fmt.Errorf("the Airbyte operator has been removed") 55 } 56 57 func (o *operator) Test(sysVars map[string]any, connection *structpb.Struct) error { 58 return fmt.Errorf("the Airbyte operator has been removed") 59 }