github.com/rohankumardubey/aresdb@v0.0.2-0.20190517170215-e54e3ca06b9c/api/query_request.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 api
    16  
    17  import (
    18  	"github.com/uber/aresdb/query"
    19  )
    20  
    21  // QueryContext contains settings common for all requests
    22  type RequestContext struct {
    23  	Device                int
    24  	Verbose               int
    25  	Debug                 int
    26  	Profiling             string
    27  	DeviceChoosingTimeout int
    28  	Accept                string
    29  	Origin                string
    30  }
    31  
    32  // AQLRequest represents AQL query request. Debug mode will
    33  // run **each batch** in synchronized mode and report time
    34  // for each step.
    35  // swagger:parameters queryAQL
    36  type AQLRequest struct {
    37  	// in: query
    38  	Device int `query:"device,optional" json:"device"`
    39  	// in: query
    40  	Verbose int `query:"verbose,optional" json:"verbose"`
    41  	// in: query
    42  	Debug int `query:"debug,optional" json:"debug"`
    43  	// in: query
    44  	Profiling string `query:"profiling,optional" json:"profiling"`
    45  	// in: query
    46  	Query string `query:"q,optional" json:"q"`
    47  	// in: query
    48  	DeviceChoosingTimeout int `query:"timeout,optional" json:"timeout"`
    49  	// in: header
    50  	Accept string `header:"Accept,optional" json:"accept"`
    51  	// in: header
    52  	Origin string `header:"Rpc-Caller,optional" json:"origin"`
    53  	// in: body
    54  	Body query.AQLRequest `body:""`
    55  }
    56  
    57  // SQLRequest represents SQL query request. Debug mode will
    58  // run **each batch** in synchronized mode and report time
    59  // for each step.
    60  // swagger:parameters querySQL
    61  type SQLRequest struct {
    62  	// in: query
    63  	Device int `query:"device,optional" json:"device"`
    64  	// in: query
    65  	Verbose int `query:"verbose,optional" json:"verbose"`
    66  	// in: query
    67  	Debug int `query:"debug,optional" json:"debug"`
    68  	// in: query
    69  	Profiling string `query:"profiling,optional" json:"profiling"`
    70  	// in: query
    71  	DeviceChoosingTimeout int `query:"timeout,optional" json:"timeout"`
    72  	// in: header
    73  	Accept string `header:"Accept,optional" json:"accept"`
    74  	// in: header
    75  	Origin string `header:"Rpc-Caller,optional" json:"origin"`
    76  	// in: body
    77  	Body struct {
    78  		Queries []string `json:"queries"`
    79  	} `body:""`
    80  }