MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Format

Method Format

pkg/sql/sem/tree/schedule.go:47–86  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

45
46// Format implements the NodeFormatter interface.
47func (node *ScheduledBackup) Format(ctx *FmtCtx) {
48 ctx.WriteString("CREATE SCHEDULE")
49
50 ctx.FormatNode(&node.ScheduleLabelSpec)
51 ctx.WriteString(" FOR BACKUP")
52 if node.Targets != nil {
53 ctx.WriteString(" ")
54 ctx.FormatNode(node.Targets)
55 }
56
57 ctx.WriteString(" INTO ")
58 ctx.FormatURIs(node.To)
59
60 if !node.BackupOptions.IsDefault() {
61 ctx.WriteString(" WITH ")
62 ctx.FormatNode(&node.BackupOptions)
63 }
64
65 ctx.WriteString(" RECURRING ")
66 if node.Recurrence == nil {
67 ctx.WriteString("NEVER")
68 } else {
69 ctx.FormatNode(node.Recurrence)
70 }
71
72 if node.FullBackup != nil {
73
74 if node.FullBackup.Recurrence != nil {
75 ctx.WriteString(" FULL BACKUP ")
76 ctx.FormatNode(node.FullBackup.Recurrence)
77 } else if node.FullBackup.AlwaysFull {
78 ctx.WriteString(" FULL BACKUP ALWAYS")
79 }
80 }
81
82 if node.ScheduleOptions != nil {
83 ctx.WriteString(" WITH SCHEDULE OPTIONS ")
84 ctx.FormatNode(&node.ScheduleOptions)
85 }
86}
87
88// Coverage return the coverage (all vs requested).
89func (node ScheduledBackup) Coverage() DescriptorCoverage {

Callers

nothing calls this directly

Calls 3

FormatNodeMethod · 0.80
FormatURIsMethod · 0.80
IsDefaultMethod · 0.45

Tested by

no test coverage detected