api

package
v0.0.0-...-fbd5fee Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	ConnectionID string            `json:"connection_id" binding:"required"`
	Question     string            `json:"question" binding:"required"`
	History      []llm.ChatMessage `json:"history"`
}

type ChatResponse

type ChatResponse struct {
	Question        string          `json:"question"`
	GeneratedSQL    string          `json:"generated_sql"`
	Result          *db.QueryResult `json:"result,omitempty"`
	Error           string          `json:"error,omitempty"`
	ExecutionTimeMs int64           `json:"execution_time_ms"`
	TokensUsed      int             `json:"tokens_used"`
}

type ConnectionResponse

type ConnectionResponse struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	DBType    string    `json:"db_type"`
	Host      string    `json:"host"`
	Port      int       `json:"port"`
	Database  string    `json:"database"`
	Username  string    `json:"username"`
	CreatedAt time.Time `json:"created_at"`
}

type CreateConnectionRequest

type CreateConnectionRequest struct {
	Name     string `json:"name" binding:"required"`
	DBType   string `json:"db_type" binding:"required,oneof=postgres mysql"`
	Host     string `json:"host" binding:"required"`
	Port     int    `json:"port" binding:"required"`
	Database string `json:"database" binding:"required"`
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(logger zerolog.Logger, st *store.Store, cm *db.ConnectorManager, crypto *db.Crypto, cfg *config.Config, llmSvc *llm.Service) *Server

func (*Server) Router

func (s *Server) Router() *gin.Engine

func (*Server) SetupRoutes

func (s *Server) SetupRoutes()

Jump to

Keyboard shortcuts

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