-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_subscription.go
46 lines (35 loc) · 1.18 KB
/
create_subscription.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
package influxqb
import "github.com/influxdata/influxql"
type CreateSubscriptionBuilder struct {
subStm *influxql.CreateSubscriptionStatement
}
type SubscriptionMode string
const ANY SubscriptionMode = "ANY"
const ALL SubscriptionMode = "ALL"
func (b *CreateSubscriptionBuilder) WithName(str string) *CreateSubscriptionBuilder {
b.subStm.Name = str
return b
}
func (b *CreateSubscriptionBuilder) WithDatabase(str string) *CreateSubscriptionBuilder {
b.subStm.Database = str
return b
}
func (b *CreateSubscriptionBuilder) WithRetentionPolicy(str string) *CreateSubscriptionBuilder {
b.subStm.RetentionPolicy = str
return b
}
func (b *CreateSubscriptionBuilder) WithMode(mode SubscriptionMode) *CreateSubscriptionBuilder {
b.subStm.Mode = string(mode)
return b
}
func (b *CreateSubscriptionBuilder) WithDestination(str string) *CreateSubscriptionBuilder {
b.subStm.Destinations = append(b.subStm.Destinations, str)
return b
}
func (b *CreateSubscriptionBuilder) WithDestinations(str ...string) *CreateSubscriptionBuilder {
b.subStm.Destinations = append(b.subStm.Destinations, str...)
return b
}
func (b *CreateSubscriptionBuilder) Build() (string, error) {
return b.subStm.String(), nil
}