bring back yahoo pipes!
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 65 lines 1.6 kB view raw
1package nodes 2 3import ( 4 "context" 5 6 "github.com/kierank/pipes/store" 7) 8 9type Node interface { 10 Type() string 11 Label() string 12 Description() string 13 Category() string // source|transform|output 14 15 Inputs() int 16 Outputs() int 17 18 Execute(ctx context.Context, config map[string]interface{}, inputs [][]interface{}, execCtx *Context) ([]interface{}, error) 19 20 ValidateConfig(config map[string]interface{}) error 21 22 GetConfigSchema() *ConfigSchema 23} 24 25type ConfigSchema struct { 26 Fields []ConfigField `json:"fields"` 27} 28 29type ConfigField struct { 30 Name string `json:"name"` 31 Label string `json:"label"` 32 Type string `json:"type"` // text|url|number|select|textarea|checkbox 33 Required bool `json:"required,omitempty"` 34 DefaultValue interface{} `json:"defaultValue,omitempty"` 35 Options []FieldOption `json:"options,omitempty"` 36 Placeholder string `json:"placeholder,omitempty"` 37 HelpText string `json:"helpText,omitempty"` 38} 39 40type FieldOption struct { 41 Value string `json:"value"` 42 Label string `json:"label"` 43} 44 45type Context struct { 46 ExecutionID string 47 PipeID string 48 DB *store.DB 49} 50 51func NewContext(executionID, pipeID string, db *store.DB) *Context { 52 return &Context{ 53 ExecutionID: executionID, 54 PipeID: pipeID, 55 DB: db, 56 } 57} 58 59func (c *Context) Log(nodeID, level, message string) { 60 c.DB.LogExecution(c.ExecutionID, nodeID, level, message) 61} 62 63func (c *Context) SaveOutput(format, content, contentType string) error { 64 return c.DB.SavePipeOutput(c.PipeID, format, content, contentType) 65}