/
tick.cf.go
91 lines (79 loc) · 2.18 KB
/
tick.cf.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Code generated by Conflow. DO NOT EDIT.
package blocks
import (
"fmt"
"github.com/conflowio/conflow/src/conflow"
"github.com/conflowio/conflow/src/conflow/annotations"
"github.com/conflowio/conflow/src/schema"
)
func init() {
schema.Register(&schema.Object{
Metadata: schema.Metadata{
Annotations: map[string]string{
annotations.Type: "configuration",
},
ID: "github.com/conflowio/conflow/src/blocks.Tick",
},
Properties: map[string]schema.Schema{
"id": &schema.String{
Metadata: schema.Metadata{
Annotations: map[string]string{
annotations.ID: "true",
},
ReadOnly: true,
},
Format: "conflow.ID",
},
"time": &schema.String{
Metadata: schema.Metadata{
Annotations: map[string]string{
annotations.EvalStage: "close",
},
ReadOnly: true,
},
Format: "date-time",
},
},
})
}
// TickInterpreter is the Conflow interpreter for the Tick block
type TickInterpreter struct {
}
func (i TickInterpreter) Schema() schema.Schema {
s, _ := schema.Get("github.com/conflowio/conflow/src/blocks.Tick")
return s
}
// Create creates a new Tick block
func (i TickInterpreter) CreateBlock(id conflow.ID, blockCtx *conflow.BlockContext) conflow.Block {
b := &Tick{}
b.id = id
return b
}
// ValueParamName returns the name of the parameter marked as value field, if there is one set
func (i TickInterpreter) ValueParamName() conflow.ID {
return ""
}
// ParseContext returns with the parse context for the block
func (i TickInterpreter) ParseContext(ctx *conflow.ParseContext) *conflow.ParseContext {
var nilBlock *Tick
if b, ok := conflow.Block(nilBlock).(conflow.ParseContextOverrider); ok {
return ctx.New(b.ParseContextOverride())
}
return ctx
}
func (i TickInterpreter) Param(b conflow.Block, name conflow.ID) interface{} {
switch name {
case "id":
return b.(*Tick).id
case "time":
return b.(*Tick).time
default:
panic(fmt.Errorf("unexpected parameter %q in Tick", name))
}
}
func (i TickInterpreter) SetParam(block conflow.Block, name conflow.ID, value interface{}) error {
return nil
}
func (i TickInterpreter) SetBlock(block conflow.Block, name conflow.ID, key string, value interface{}) error {
return nil
}