Documentation
¶
Index ¶
- func ExpandSQL(SQL string, args []interface{}) string
- type Buffered
- type CacheStats
- type Compressed
- type Error
- type ErrorOption
- type Errors
- type Execution
- type JobInfo
- type Metric
- type Metrics
- type Option
- type Options
- type ParametrizedSQL
- type Response
- type SQLExecution
- type Status
- type StatusCoder
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffered ¶
type Buffered struct {
// contains filtered or unexported fields
}
Buffered represents a buffered response
func NewBuffered ¶
func (*Buffered) CompressionType ¶
func (*Buffered) SetStatusCode ¶
func (*Buffered) StatusCode ¶
type CacheStats ¶
type Compressed ¶
type Compressed interface {
CompressionType() string
}
Compressed represents a compressed response
type Error ¶
type Error struct { View string `json:"view,omitempty" ` Parameter string `json:"parameter,omitempty" ` Code int `json:"statusCode,omitempty" ` Err error `json:"-"` Message string `json:"message,omitempty" ` Object interface{} `json:"object,omitempty" ` }
Error represents an error
func NewError ¶
func NewError(code int, message string, opts ...ErrorOption) *Error
NewError creates a new error
func NewParameterError ¶
func NewParameterError(view, parameter string, err error, opts ...ErrorOption) *Error
NewParameterError creates a new parameter error
func (*Error) SetStatusCode ¶
func (*Error) StatusCode ¶
type ErrorOption ¶
type ErrorOption func(e *Error)
ErrorOption represents an error option
func WithErrorMessage ¶
func WithErrorMessage(message string) ErrorOption
WithErrorMessage sets the error message
func WithErrorStatusCode ¶
func WithErrorStatusCode(code int) ErrorOption
WithErrorStatusCode sets the error status code
func WithParameter ¶
func WithParameter(parameter string) ErrorOption
WithParameter sets the error parameter
type Errors ¶
type Errors struct { Message string `json:",omitempty" ` Errors []*Error // contains filtered or unexported fields }
Errors represents a list of errors
func (*Errors) AddError ¶
func (e *Errors) AddError(view, param string, err error, opts ...ErrorOption)
AddError adds an error
func (*Errors) SetStatusCode ¶
SetStatusCode sets status code
func (*Errors) StatusCode ¶
type Execution ¶
type Execution struct { View []*SQLExecution `json:",omitempty"` Summary []*SQLExecution `json:",omitempty"` Elapsed string `json:",omitempty"` }
type JobInfo ¶
type JobInfo struct { RequestTime time.Time `json:",omitempty"` JobStatus string `json:",omitempty"` CreateTime time.Time `json:",omitempty"` WaitTimeInMs int `json:",omitempty"` RunTimeInMs int `json:",omitempty"` ExpiryInSec int `json:",omitempty"` CacheKey string `json:",omitempty"` CacheHit bool `json:",omitempty"` MatchKey string `json:",omitempty"` }
type Metric ¶
type Metric struct { View string `json:",omitempty"` Elapsed string `json:",omitempty"` ElapsedMs int `json:",omitempty"` Rows int `json:",omitempty"` Execution *Execution `json:",omitempty"` }
func (*Metric) ParametrizedSQL ¶
func (m *Metric) ParametrizedSQL() []*ParametrizedSQL
type Metrics ¶
type Metrics []*Metric
func (Metrics) ParametrizedSQL ¶
func (m Metrics) ParametrizedSQL() []*ParametrizedSQL
type Option ¶
type Option func(r *Buffered)
Option represents a buffered response option
func WithBuffer ¶
WithBuffer returns an option that sets the buffer
func WithCompressions ¶
WithCompressions returns an option that sets the compression type
func WithHeader ¶
WithHeader returns an option that sets the header
func WithHeaders ¶
WithHeaders returns an option that sets the headers
func WithStatusCode ¶
WithStatusCode returns an option that sets the status code
type Options ¶
type Options []Option
Options represents a list of buffered response options
func (*Options) AdjustStatusCode ¶
func (o *Options) AdjustStatusCode(candidates ...interface{})
AdjustStatusCode adjusts the status code
type ParametrizedSQL ¶
type ParametrizedSQL struct { Query string Args []interface{} }
type Response ¶
type Response interface { StatusCoder Body() io.Reader Headers() http.Header Size() int SetStatusCode(int) }
Response represents a response
func BuildErrorResponse ¶
BuildErrorResponse builds an error response
type SQLExecution ¶
type SQLExecution struct { SQL string `json:",omitempty"` Args []interface{} `json:",omitempty"` CacheStats *CacheStats `json:",omitempty"` Error string `json:",omitempty"` CacheError string `json:",omitempty"` }
type StatusCoder ¶
type StatusCoder interface {
StatusCode() int
}
StatusCoder represents a status code