github.com/rohankumardubey/aresdb@v0.0.2-0.20190517170215-e54e3ca06b9c/query/sql/tree/QuerySpecification.go (about)

     1  //  Copyright (c) 2017-2018 Uber Technologies, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package tree
    16  
    17  // QuerySpecification is QuerySpecification
    18  type QuerySpecification struct {
    19  	// QueryBody is IQueryBody
    20  	IQueryBody
    21  	// Select is Select
    22  	Select *Select
    23  	// From is IRelation
    24  	From IRelation
    25  	// Where is IExpression
    26  	Where IExpression
    27  	// GroupBy is GroupBy
    28  	GroupBy *GroupBy
    29  	// Having is IExpression
    30  	Having IExpression
    31  	// OrderBy is OrderBy
    32  	OrderBy *OrderBy
    33  	// Limit is limit
    34  	Limit string
    35  }
    36  
    37  // NewQuerySpecification creates QuerySpecification
    38  func NewQuerySpecification(location *NodeLocation,
    39  	sel *Select,
    40  	from IRelation,
    41  	where IExpression,
    42  	groupBy *GroupBy,
    43  	having IExpression,
    44  	orderBy *OrderBy,
    45  	limit string) *QuerySpecification {
    46  	return &QuerySpecification{
    47  		NewQueryBody(location),
    48  		sel,
    49  		from,
    50  		where,
    51  		groupBy,
    52  		having,
    53  		orderBy,
    54  		limit,
    55  	}
    56  }
    57  
    58  // Accept accepts visitor
    59  func (e *QuerySpecification) Accept(visitor AstVisitor, ctx interface{}) interface{} {
    60  	return visitor.VisitQuerySpecification(e, ctx)
    61  }