Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix format duration #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,15 @@ func (s *CreateDatabaseStatement) String() string {
_, _ = buf.WriteString(" WITH")
if s.RetentionPolicyDuration != nil {
_, _ = buf.WriteString(" DURATION ")
_, _ = buf.WriteString(s.RetentionPolicyDuration.String())
_, _ = buf.WriteString(FormatDuration(*s.RetentionPolicyDuration))
}
if s.RetentionPolicyReplication != nil {
_, _ = buf.WriteString(" REPLICATION ")
_, _ = buf.WriteString(strconv.Itoa(*s.RetentionPolicyReplication))
}
if s.RetentionPolicyShardGroupDuration > 0 {
_, _ = buf.WriteString(" SHARD DURATION ")
_, _ = buf.WriteString(s.RetentionPolicyShardGroupDuration.String())
_, _ = buf.WriteString(FormatDuration(s.RetentionPolicyShardGroupDuration))
}
if s.RetentionPolicyName != "" {
_, _ = buf.WriteString(" NAME ")
Expand Down Expand Up @@ -1405,8 +1405,8 @@ func (s *SelectStatement) RewriteFields(m FieldMapper) (*SelectStatement, error)
//
// Conditions that can currently be simplified are:
//
// - host =~ /^foo$/ becomes host = 'foo'
// - host !~ /^foo$/ becomes host != 'foo'
// - host =~ /^foo$/ becomes host = 'foo'
// - host !~ /^foo$/ becomes host != 'foo'
//
// Note: if the regex contains groups, character classes, repetition or
// similar, it's likely it won't be rewritten. In order to support rewriting
Expand Down