-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_database.go
29 lines (22 loc) · 981 Bytes
/
create_database.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
package influxqb
import "github.com/influxdata/influxql"
type CreateDatabaseBuilder struct {
dbStatement *influxql.CreateDatabaseStatement
}
func (b *CreateDatabaseBuilder) WithName(str string) *CreateDatabaseBuilder {
b.dbStatement.Name = str
return b
}
func (b *CreateDatabaseBuilder) WithRetentionPolicy(retentionPolicy *CreateRetentionPolicyBuilder) *CreateDatabaseBuilder {
b.dbStatement.RetentionPolicyCreate = true
b.dbStatement.RetentionPolicyName = retentionPolicy.ret.Name
b.dbStatement.RetentionPolicyDuration = &retentionPolicy.ret.Duration
b.dbStatement.RetentionPolicyReplication = &retentionPolicy.ret.Replication
b.dbStatement.RetentionPolicyShardGroupDuration = retentionPolicy.ret.ShardGroupDuration
b.dbStatement.FutureWriteLimit = &retentionPolicy.ret.FutureWriteLimit
b.dbStatement.PastWriteLimit = &retentionPolicy.ret.PastWriteLimit
return b
}
func (b *CreateDatabaseBuilder) Build() (string, error) {
return b.dbStatement.String(), nil
}