dataapi

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 25 Imported by: 0

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

func (s *Server) HTTPServer() *http.Server

HTTPServer returns an *http.Server with the Data API routes registered. The caller is responsible for calling Serve/Shutdown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL