server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package server provides HTTP server functionality for sql-http-proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServeMux

func NewServeMux(db *sqlx.DB, cfg config.Config, configDir string) (http.Handler, error)

NewServeMux creates a new chi Router with all configured handlers. db can be nil if all endpoints use mock. configDir is the directory of the config file for resolving relative paths.

Types

type Executor

type Executor[R any] interface {
	Execute(ctx context.Context, params map[string]any, opts executor.Options) (*R, error)
}

Executor is the interface for query/mutation executors.

type MutationHandler

type MutationHandler = baseHandler[executor.MutationResult]

MutationHandler handles HTTP requests for mutations.

func NewMutationHandler

func NewMutationHandler(db *sqlx.DB, mutation config.Mutation) (*MutationHandler, error)

NewMutationHandler creates a new MutationHandler. db can be nil if mock is configured.

type QueryHandler

type QueryHandler = baseHandler[executor.ExecuteResult]

QueryHandler handles HTTP requests for queries.

func NewQueryHandler

func NewQueryHandler(db *sqlx.DB, query config.Query) (*QueryHandler, error)

NewQueryHandler creates a new QueryHandler. db can be nil if mock is configured.

type ResultProcessor

type ResultProcessor[R any] interface {
	// BuildResponse returns (status, output, responseHeader) from the result.
	BuildResponse(result *R) (status int, output any, headers http.Header)
}

ResultProcessor handles result-specific response building.

Directories

Path Synopsis
Package body provides HTTP request body parsing with Content-Type handling.
Package body provides HTTP request body parsing with Content-Type handling.

Jump to

Keyboard shortcuts

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