-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfind_channel.go
39 lines (33 loc) · 882 Bytes
/
find_channel.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
package pluto
const ProcessorName_FindChannel = "Find Channel"
func init() {
PredefinedProcessors[ProcessorName_FindChannel] = func(args []Value) (p Processor, err error) {
defer creatorPanicHandler(ProcessorName_FindChannel, &err)()
return FindChannel{
Name: Find("Name", args...).Value.(string),
}, err
}
}
type FindChannel struct {
Name string
}
func (p FindChannel) Process(processable Processable) (Processable, bool) {
for _, channel := range Channels {
if channel.Name == p.Name {
processable.SetBody(channel)
return processable, true
}
}
return processable, false
}
func (p FindChannel) GetDescriptor() ProcessorDescriptor {
return ProcessorDescriptor{}
}
//func findChannel(name string) (Channel, bool) {
// for _, channel := range Channels {
// if channel.Name == name {
// return channel, true
// }
// }
// return Channel{}, false
//}