Documentation
¶
Overview ¶
Package dataapi exposes a RESTful HTTP interface for executing SQL queries against the proxy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse is the HTTP error response body.
type QueryRequest ¶
type QueryRequest struct {
SQL string `json:"sql"`
}
QueryRequest is the HTTP request body for /v1/query.
type QueryResponse ¶
type QueryResponse struct {
Columns []string `json:"columns,omitempty"`
Types []string `json:"types,omitempty"`
Rows [][]any `json:"rows,omitempty"`
RowCount int `json:"row_count"`
Command string `json:"command,omitempty"`
}
QueryResponse is the HTTP response body for /v1/query.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the Data API HTTP server.
func New ¶
func New(cfgFn func() *config.Config, dbGroupsFn func() map[string]*proxy.DatabaseGroup, defaultDBFn func() string, queryCacheFn func() *cache.Cache, met *metrics.Metrics, rateLimiterFn func() *resilience.RateLimiter, invalidatorFn func() *cache.Invalidator) *Server
New creates a new Data API server.
func (*Server) HTTPServer ¶
HTTPServer returns an *http.Server with the Data API routes registered. The caller is responsible for calling Serve/Shutdown.
Click to show internal directories.
Click to hide internal directories.