Skip to content

Commit

Permalink
validate methods can be private
Browse files Browse the repository at this point in the history
  • Loading branch information
corylanou committed May 19, 2015
1 parent 8bce992 commit b263117
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions influxql/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,13 +897,12 @@ func (s *SelectStatement) hasTimeDimensions(node Node) bool {
}
}

// Validate checks certain edge conditions to determine if this is a valid select statment
func (s *SelectStatement) Validate(tr targetRequirement) error {
if err := s.ValidateDistinct(); err != nil {
func (s *SelectStatement) validate(tr targetRequirement) error {
if err := s.validateDistinct(); err != nil {
return err
}

if err := s.ValidateAggregates(tr); err != nil {
if err := s.validateAggregates(tr); err != nil {
return err
}

Expand All @@ -914,7 +913,7 @@ func (s *SelectStatement) Validate(tr targetRequirement) error {
return nil
}

func (s *SelectStatement) ValidateAggregates(tr targetRequirement) error {
func (s *SelectStatement) validateAggregates(tr targetRequirement) error {
// fetch the group by duration
groupByDuration, _ := s.GroupByInterval()

Expand Down Expand Up @@ -947,8 +946,7 @@ func (s *SelectStatement) HasDistinct() bool {
return false
}

// ValdiateDistinct ensures we have a properly constructed distinct statement
func (s *SelectStatement) ValidateDistinct() error {
func (s *SelectStatement) validateDistinct() error {
if !s.HasDistinct() {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion influxql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ func (p *Parser) parseSelectStatement(tr targetRequirement) (*SelectStatement, e
}
})

if err := stmt.Validate(tr); err != nil {
if err := stmt.validate(tr); err != nil {
return nil, err
}

Expand Down

0 comments on commit b263117

Please sign in to comment.